public void OrgIdHash_NullInput() { SecureString password = null; byte[] salt = "317ee9d1dec6508fa510".HexToBinary(); string result = OrgIdHash.ComputeFormattedHash(password, salt); }
protected override void ProcessRecord() { this.WriteVerbose("Calculating OrgId hash."); try { string orgIdHash; // TODO: Switch by parametersetname if (this.NTHash != null) { // Calculate OrgId hash from NT Hash: byte[] binaryNTHash = NTHash; orgIdHash = OrgIdHash.ComputeFormattedHash(this.NTHash, this.Salt); } else { // Calculate OrgId hash from password: orgIdHash = OrgIdHash.ComputeFormattedHash(this.Password, this.Salt); } this.WriteObject(orgIdHash); } catch (Exception ex) { ErrorRecord error = new ErrorRecord(ex, "Error1", ErrorCategory.NotSpecified, this.Password); this.WriteError(error); } }
public void OrgIdHash_HashLength() { SecureString pwd = "Pa$$w0rd".ToSecureString(); byte[] salt = OrgIdHash.GenerateSalt(); byte[] hash = OrgIdHash.ComputeHash(pwd, salt); Assert.AreEqual(OrgIdHash.HashSize, hash.Length); }
public void OrgIdHash_EmptyInput() { SecureString password = string.Empty.ToSecureString(); byte[] salt = "317ee9d1dec6508fa510".HexToBinary(); string result = OrgIdHash.ComputeFormattedHash(password, salt); string expected = "v1;PPH1_MD4,317ee9d1dec6508fa510,100,f56b3637eb57e927438c6d0ebbd69d1d95f8e849912915a6733a33921c8e4806;"; Assert.AreEqual(expected, result); }
public void OrgIdHash_TestVector1() { SecureString password = "******".ToSecureString(); byte[] salt = "317ee9d1dec6508fa510".HexToBinary(); string result = OrgIdHash.ComputeFormattedHash(password, salt); string expected = "v1;PPH1_MD4,317ee9d1dec6508fa510,100,f4a257ffec53809081a605ce8ddedfbc9df9777b80256763bc0a6dd895ef404f;"; Assert.AreEqual(expected, result); }
public void OrgIdHash_EmptyInput() { SecureString password = string.Empty.ToSecureString(); byte[] salt = "01cda06eceb9d9bc2621".HexToBinary(); string result = OrgIdHash.ComputeFormattedHash(password, salt); string expected = "v1;PPH1_MD4,01cda06eceb9d9bc2621,1000,9d4fc778add44776555d3fa6ccb4f9637f25e34a62dbc5fa0f782ef8c762c902;"; Assert.AreEqual(expected, result); }
public void OrgIdHash_TestVector1() { SecureString password = "******".ToSecureString(); byte[] salt = "181a3024085fcee2f70e".HexToBinary(); string result = OrgIdHash.ComputeFormattedHash(password, salt); string expected = "v1;PPH1_MD4,181a3024085fcee2f70e,1000,b39525c3bc72a1136fcf7c8a338e0c14313d0450d1a4c98ef0a6ddada3bc5b0a;"; Assert.AreEqual(expected, result); }
public void OrgIdHash_SaltLength() { byte[] salt = OrgIdHash.GenerateSalt(); Assert.AreEqual(OrgIdHash.SaltSize, salt.Length); }