Fix Argon2 Attempt #2 (#147)

This commit is contained in:
Kamron Batman 2020-05-25 23:28:04 -07:00 • committed by GitHub
parent f6dd0e21c6
commit fddfa15192
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 64 additions and 18 deletions

View file

@ -94,7 +94,7 @@ namespace System.Security.Cryptography
Span<byte> passwordBytes = stackalloc byte[StringEncoding.GetByteCount(password)];
StringEncoding.GetBytes(password, passwordBytes);
var result = Argon2.Hash(
var result = Argon2.Library.Hash(
TimeCost,
MemoryCost,
Parallelism,
@ -128,7 +128,7 @@ namespace System.Security.Cryptography
Span<byte> passwordBytes = stackalloc byte[StringEncoding.GetByteCount(password)];
StringEncoding.GetBytes(password, passwordBytes);
var result = Argon2.Hash(
var result = Argon2.Library.Hash(
TimeCost,
MemoryCost,
Parallelism,
@ -172,7 +172,7 @@ namespace System.Security.Cryptography
/// </summary>
public bool Verify(ReadOnlySpan<byte> expectedHash, ReadOnlySpan<byte> password)
{
var result = Argon2.Verify(expectedHash, password, password.Length, (int)ArgonType);
var result = Argon2.Library.Verify(expectedHash, password, password.Length, (int)ArgonType);
if (result == Argon2Error.OK || result == Argon2Error.VERIFY_MISMATCH || result == Argon2Error.DECODING_FAIL)
return result == Argon2Error.OK;
@ -246,7 +246,7 @@ namespace System.Security.Cryptography
Span<byte> bytes = stackalloc byte[formattedHash.Length];
Encoding.ASCII.GetBytes(formattedHash, bytes);
var result = Argon2.Decode(context, bytes, (int)type);
var result = Argon2.Library.Decode(context, bytes, (int)type);
if (result != Argon2Error.OK)
return null;