From 6e332307e95d72bd67f33c72896966b032c71815 Mon Sep 17 00:00:00 2001 From: MichaelGrafnetter Date: Tue, 8 Nov 2016 22:21:51 +0100 Subject: [PATCH] Resolved #34 --- .../Cryptography/OrgIdHashTester.cs | 9 ++++----- Src/DSInternals.Common/Cryptography/OrgIdHash.cs | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Src/DSInternals.Common.Test/Cryptography/OrgIdHashTester.cs b/Src/DSInternals.Common.Test/Cryptography/OrgIdHashTester.cs index eda7622..f1e6119 100644 --- a/Src/DSInternals.Common.Test/Cryptography/OrgIdHashTester.cs +++ b/Src/DSInternals.Common.Test/Cryptography/OrgIdHashTester.cs @@ -12,9 +12,9 @@ namespace DSInternals.Common.Cryptography.Test public void OrgIdHash_TestVector1() { SecureString password = "Pa$$w0rd".ToSecureString(); - byte[] salt = "317ee9d1dec6508fa510".HexToBinary(); + byte[] salt = "181a3024085fcee2f70e".HexToBinary(); string result = OrgIdHash.ComputeFormattedHash(password, salt); - string expected = "v1;PPH1_MD4,317ee9d1dec6508fa510,100,f4a257ffec53809081a605ce8ddedfbc9df9777b80256763bc0a6dd895ef404f;"; + string expected = "v1;PPH1_MD4,181a3024085fcee2f70e,1000,b39525c3bc72a1136fcf7c8a338e0c14313d0450d1a4c98ef0a6ddada3bc5b0a;"; Assert.AreEqual(expected, result); } [TestMethod] @@ -29,9 +29,9 @@ namespace DSInternals.Common.Cryptography.Test public void OrgIdHash_EmptyInput() { SecureString password = string.Empty.ToSecureString(); - byte[] salt = "317ee9d1dec6508fa510".HexToBinary(); + byte[] salt = "01cda06eceb9d9bc2621".HexToBinary(); string result = OrgIdHash.ComputeFormattedHash(password, salt); - string expected = "v1;PPH1_MD4,317ee9d1dec6508fa510,100,f56b3637eb57e927438c6d0ebbd69d1d95f8e849912915a6733a33921c8e4806;"; + string expected = "v1;PPH1_MD4,01cda06eceb9d9bc2621,1000,9d4fc778add44776555d3fa6ccb4f9637f25e34a62dbc5fa0f782ef8c762c902;"; Assert.AreEqual(expected, result); } [TestMethod] @@ -48,6 +48,5 @@ namespace DSInternals.Common.Cryptography.Test byte[] hash = OrgIdHash.ComputeHash(pwd, salt); Assert.AreEqual(OrgIdHash.HashSize, hash.Length); } - } } diff --git a/Src/DSInternals.Common/Cryptography/OrgIdHash.cs b/Src/DSInternals.Common/Cryptography/OrgIdHash.cs index b7e6259..fc8b1ba 100644 --- a/Src/DSInternals.Common/Cryptography/OrgIdHash.cs +++ b/Src/DSInternals.Common/Cryptography/OrgIdHash.cs @@ -13,7 +13,7 @@ namespace DSInternals.Common.Cryptography /// The size, in bytes, of the computed hash code. /// public const int HashSize = 32; - private const int Iterations = 100; + private const int Iterations = 1000; private const string HashFormat = "v1;PPH1_MD4,{0},{1},{2};"; private const string InternalHashFunction = "HMACSHA256";