コード例 #1
0
 protected override void ProcessRecord()
 {
     this.WriteVerbose("Calculating OrgId hash.");
     try
     {
         byte[] binarySalt = null;
         if (Salt != null)
         {
             binarySalt = Salt.HexToBinary();
         }
         string orgIdHash;
         // TODO: Switch by parametersetname
         if (NTHash != null)
         {
             // Calculate OrgId hash from NT Hash:
             byte[] binaryNTHash = NTHash.HexToBinary();
             orgIdHash = OrgIdHash.ComputeFormattedHash(binaryNTHash, binarySalt);
         }
         else
         {
             // Calculate OrgId hash from password:
             orgIdHash = OrgIdHash.ComputeFormattedHash(Password, binarySalt);
         }
         this.WriteObject(orgIdHash);
     }
     catch (Exception ex)
     {
         ErrorRecord error = new ErrorRecord(ex, "Error1", ErrorCategory.NotSpecified, this.Password);
         this.WriteError(error);
     }
 }