Skip to content

Commit

Permalink
Fixed issue method been called Finalize as this could be confused C# …
Browse files Browse the repository at this point in the history
…syntax

Signed-off-by: TestLiam <liamwilson127@gmail.com>
  • Loading branch information
TechLiam committed Oct 12, 2019
1 parent 50b01c9 commit 5ab0109
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion SqrlForNet/Chaos.NaCl/Internal/Ed25519Ref10/open.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static bool crypto_sign_verify(
hasher.Update(sig, sigoffset, 32);
hasher.Update(pk, pkoffset, 32);
hasher.Update(m, moffset, mlen);
h = hasher.Finalize();
h = hasher.FinalizeHash();

ScalarOperations.sc_reduce(h);

Expand Down
6 changes: 3 additions & 3 deletions SqrlForNet/Chaos.NaCl/Internal/Ed25519Ref10/sign.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ public static void crypto_sign(
var hasher = new Sha512();
{
hasher.Update(sk, skoffset, 32);
az = hasher.Finalize();
az = hasher.FinalizeHash();
ScalarOperations.sc_clamp(az, 0);

hasher.Init();
hasher.Update(az, 32, 32);
hasher.Update(m, moffset, mlen);
r = hasher.Finalize();
r = hasher.FinalizeHash();

ScalarOperations.sc_reduce(r);
GroupOperations.ge_scalarmult_base(out R, r, 0);
Expand All @@ -30,7 +30,7 @@ public static void crypto_sign(
hasher.Update(sig, sigoffset, 32);
hasher.Update(sk, skoffset + 32, 32);
hasher.Update(m, moffset, mlen);
hram = hasher.Finalize();
hram = hasher.FinalizeHash();

ScalarOperations.sc_reduce(hram);
var s = new byte[32];//todo: remove allocation
Expand Down
8 changes: 4 additions & 4 deletions SqrlForNet/Chaos.NaCl/Sha512.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void Update(byte[] data, int index, int length)
/// Finalizes SHA-512 hashing
/// </summary>
/// <param name="output">Output buffer</param>
public void Finalize(ArraySegment<byte> output)
public void FinalizeHash(ArraySegment<byte> output)
{
Update(_padding, 0, _padding.Length);
Array16<ulong> block;
Expand Down Expand Up @@ -117,10 +117,10 @@ public void Finalize(ArraySegment<byte> output)
/// Finalizes SHA-512 hashing.
/// </summary>
/// <returns>Hash bytes</returns>
public byte[] Finalize()
public byte[] FinalizeHash()
{
var result = new byte[64];
Finalize(new ArraySegment<byte>(result));
FinalizeHash(new ArraySegment<byte>(result));
return result;
}

Expand All @@ -145,7 +145,7 @@ public static byte[] Hash(byte[] data, int index, int length)
{
var hasher = new Sha512();
hasher.Update(data, index, length);
return hasher.Finalize();
return hasher.FinalizeHash();
}
}
}

0 comments on commit 5ab0109

Please sign in to comment.