protected override void ProcessRecordInEH() { string encodingName = EncodingName; if (string.IsNullOrWhiteSpace(encodingName)) { encodingName = EncodingFactory.EncodingNames.UTF8; } Encoding encoding = EncodingFactory.Get(encodingName); if (encoding == null) { throw new PSArgumentException(string.Format("Unsupported encoding: {0}", encodingName)); } HashAlgorithm algorithm = HashAlgorithmFactory.Create(Algorithm); if (algorithm == null) { throw new PSArgumentException(string.Format("Unsupported algorithm: {0}", Algorithm)); } byte[] hashBuffer = HashGenerator.ComputeStringHash(InputObject, algorithm, encoding); HashResult result = new HashResult() { Algorithm = Algorithm, Hash = hashBuffer.ToHex(), HashBuffer = hashBuffer, }; WriteObject(result); }