Skip to content

Commit

Permalink
fix Salsa20
Browse files Browse the repository at this point in the history
  • Loading branch information
ZingBallyhoo committed Nov 16, 2023
1 parent 3bd43c5 commit 7dd4503
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions TACTLib/Core/Salsa20.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void Transform(ReadOnlySpan<byte> input, Span<byte> output) {
var hashOutputBytes = MemoryMarshal.Cast<uint, byte>(hashOutput);

while (input.Length > 0) {
Hash(hashOutput, m_state);
Hash(ref hashOutput, ref m_state);
m_state[8] = AddOne(m_state[8]);
if (m_state[8] == 0) m_state[9] = AddOne(m_state[9]);

Expand All @@ -68,7 +68,7 @@ public void Transform(ReadOnlySpan<byte> input, Span<byte> output) {
}
}

private static void Hash(UIntArray output, UIntArray existingState) {
private static void Hash(ref UIntArray output, ref readonly UIntArray existingState) {
var state = existingState;

for (var round = ROUNDS; round > 0; round -= 2) {
Expand Down

0 comments on commit 7dd4503

Please sign in to comment.