private void HashTestOthers(IArgon2ParametersBuilder a_Argon2ParametersBuilder, Argon2Version a_Version, Int32 a_Iterations, Int32 a_Memory, Int32 a_Parallelism, string a_Password, string a_Salt, string a_PasswordRef, Int32 a_OutputLength) { IPBKDF_Argon2 LGenerator; byte[] LSalt, LPassword; string LActual; IArgon2Parameters LArgon2Parameter; LSalt = Converters.ConvertStringToBytes(a_Salt, Encoding.ASCII); LPassword = Converters.ConvertStringToBytes(a_Password, Encoding.ASCII); a_Argon2ParametersBuilder.WithVersion(a_Version).WithIterations(a_Iterations) .WithMemoryPowOfTwo(a_Memory).WithParallelism(a_Parallelism).WithSalt(LSalt); // // Set the password. // LArgon2Parameter = a_Argon2ParametersBuilder.Build(); a_Argon2ParametersBuilder.Clear(); LGenerator = HashFactory.KDF.PBKDF_Argon2.CreatePBKDF_Argon2(LPassword, LArgon2Parameter); LActual = Converters.ConvertBytesToHexString(LGenerator.GetBytes(a_OutputLength), false); LArgon2Parameter.Clear(); LGenerator.Clear(); Assert.AreEqual(a_PasswordRef, LActual, String.Format("Expected {0} but got {1}.", a_PasswordRef, LActual)); } //
private void HashTestFromInternetDraft(IArgon2ParametersBuilder a_Argon2ParametersBuilder, Argon2Version a_Version, Int32 a_Iterations, Int32 a_MemoryAsKB, Int32 a_Parallelism, string a_Additional, string a_Secret, string a_Salt, string a_Password, string a_PasswordRef, Int32 a_OutputLength) { IPBKDF_Argon2 LGenerator; string LActual; byte[] LAdditional, LSecret, LSalt, LPassword; IArgon2Parameters LArgon2Parameter; LAdditional = Converters.ConvertHexStringToBytes(a_Additional); LSecret = Converters.ConvertHexStringToBytes(a_Secret); LSalt = Converters.ConvertHexStringToBytes(a_Salt); LPassword = Converters.ConvertHexStringToBytes(a_Password); a_Argon2ParametersBuilder.WithVersion(a_Version).WithIterations(a_Iterations) .WithMemoryAsKB(a_MemoryAsKB).WithParallelism(a_Parallelism) .WithAdditional(LAdditional).WithSecret(LSecret).WithSalt(LSalt); // // Set the password. // LArgon2Parameter = (IArgon2Parameters)a_Argon2ParametersBuilder.Build(); a_Argon2ParametersBuilder.Clear(); LGenerator = HashFactory.KDF.PBKDF_Argon2.CreatePBKDF_Argon2(LPassword, LArgon2Parameter); LActual = Converters.ConvertBytesToHexString(LGenerator.GetBytes(a_OutputLength), false); LArgon2Parameter.Clear(); LGenerator.Clear(); Assert.AreEqual(a_PasswordRef, LActual, String.Format("Expected {0} but got {1}.", a_PasswordRef, LActual)); } //