Skip to content

Commit

Permalink
refactor: drop Xor
Browse files Browse the repository at this point in the history
  • Loading branch information
HMBSbige committed Jan 14, 2024
1 parent bcf703a commit c4c4a3f
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,4 @@ protected override void UpdateKeyStream()
{
ChaCha20Utils.UpdateKeyStream(Rounds, State, KeyStream);
}

protected override unsafe void Xor(byte* stream, byte* source, byte* destination, int length)
{
IntrinsicsUtils.Xor(stream, source, destination, length);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,4 @@ protected override unsafe void UpdateKeyStream()
ChaCha20Utils.UpdateKeyStream(x, s, Rounds);
}
}

protected override unsafe void Xor(byte* stream, byte* source, byte* destination, int length)
{
IntrinsicsUtils.Xor(stream, source, destination, length);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,4 @@ protected override void UpdateKeyStream()
{
ChaCha20Utils.UpdateKeyStream(Rounds, State, KeyStream);
}

protected override unsafe void Xor(byte* stream, byte* source, byte* destination, int length)
{
IntrinsicsUtils.Xor(stream, source, destination, length);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,4 @@ protected override unsafe void UpdateKeyStream()
ChaCha20Utils.UpdateKeyStream(x, s, Rounds);
}
}

protected override unsafe void Xor(byte* stream, byte* source, byte* destination, int length)
{
IntrinsicsUtils.Xor(stream, source, destination, length);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,4 @@ protected override void UpdateKeyStream()
{
Salsa20Utils.UpdateKeyStream(Rounds, State, KeyStream);
}

protected override unsafe void Xor(byte* stream, byte* source, byte* destination, int length)
{
IntrinsicsUtils.Xor(stream, source, destination, length);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,4 @@ protected override unsafe void UpdateKeyStream()
Salsa20Utils.UpdateKeyStream(x, s, Rounds);
}
}

protected override unsafe void Xor(byte* stream, byte* source, byte* destination, int length)
{
IntrinsicsUtils.Xor(stream, source, destination, length);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private unsafe void Update(int length, uint* state, byte* stream, byte* source,
}

var r = 64 - Index;
Xor(stream + Index, source, destination, Math.Min(r, length));
IntrinsicsUtils.Xor(stream + Index, source, destination, Math.Min(r, length));

if (length < r)
{
Expand All @@ -78,7 +78,6 @@ private unsafe void Update(int length, uint* state, byte* stream, byte* source,
protected abstract unsafe void UpdateBlocks(ref uint* state, ref byte* source, ref byte* destination, ref int length);
protected abstract void UpdateKeyStream();
protected abstract unsafe void IncrementCounter(uint* state);
protected abstract unsafe void Xor(byte* stream, byte* source, byte* destination, int length);

public override void Dispose()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,4 @@ protected override void UpdateKeyStream()
{
ChaCha20Utils.UpdateKeyStream(Rounds, State, KeyStream);
}

protected override unsafe void Xor(byte* stream, byte* source, byte* destination, int length)
{
IntrinsicsUtils.Xor(stream, source, destination, length);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,4 @@ protected override unsafe void UpdateKeyStream()
ChaCha20Utils.UpdateKeyStream(x, s, Rounds);
}
}

protected override unsafe void Xor(byte* stream, byte* source, byte* destination, int length)
{
IntrinsicsUtils.Xor(stream, source, destination, length);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,4 @@ protected override void UpdateKeyStream()
{
Salsa20Utils.UpdateKeyStream(Rounds, State, KeyStream);
}

protected override unsafe void Xor(byte* stream, byte* source, byte* destination, int length)
{
IntrinsicsUtils.Xor(stream, source, destination, length);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,4 @@ protected override unsafe void UpdateKeyStream()
Salsa20Utils.UpdateKeyStream(x, s, Rounds);
}
}

protected override unsafe void Xor(byte* stream, byte* source, byte* destination, int length)
{
IntrinsicsUtils.Xor(stream, source, destination, length);
}
}

0 comments on commit c4c4a3f

Please sign in to comment.