Skip to content

Commit

Permalink
Expose Argon2 version number
Browse files Browse the repository at this point in the history
Fixes #79
  • Loading branch information
ektrah committed May 4, 2024
1 parent e94a024 commit 665e72a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Cryptography/Argon2Parameters.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;

namespace NSec.Cryptography
Expand All @@ -8,5 +9,8 @@ public struct Argon2Parameters
public int DegreeOfParallelism;
public long MemorySize;
public long NumberOfPasses;

[SuppressMessage("Performance", "CA1822")]
public readonly int Version => 0x13; // copied from libsodium/crypto_pwhash/argon2/argon2-core.h
}
}
1 change: 1 addition & 0 deletions tests/Algorithms/Argon2iTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public static void Properties()
Assert.Equal(16, a.MinSaltSize);
Assert.Equal(int.MaxValue, a.MaxCount);

Assert.Equal(19, actual.Version);
Assert.Equal(expected.DegreeOfParallelism, actual.DegreeOfParallelism);
Assert.Equal(expected.MemorySize, actual.MemorySize);
Assert.Equal(expected.NumberOfPasses, actual.NumberOfPasses);
Expand Down
1 change: 1 addition & 0 deletions tests/Algorithms/Argon2idTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public static void Properties()
Assert.Equal(16, a.MinSaltSize);
Assert.Equal(int.MaxValue, a.MaxCount);

Assert.Equal(19, actual.Version);
Assert.Equal(expected.DegreeOfParallelism, actual.DegreeOfParallelism);
Assert.Equal(expected.MemorySize, actual.MemorySize);
Assert.Equal(expected.NumberOfPasses, actual.NumberOfPasses);
Expand Down

0 comments on commit 665e72a

Please sign in to comment.