Skip to content

Commit

Permalink
Eliminate byte[] allocation in RC4
Browse files Browse the repository at this point in the history
  • Loading branch information
iamcarbon authored and BobLd committed Apr 12, 2024
1 parent fba5b60 commit ce5dc7c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/UglyToad.PdfPig/Encryption/RC4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ internal static class RC4
public static byte[] Encrypt(ReadOnlySpan<byte> key, ReadOnlySpan<byte> data)
{
// Key-scheduling algorithm
var s = new byte[256];
Span<byte> s = stackalloc byte[256];
for (var i = 0; i < 256; i++)
{
s[i] = (byte)i;
Expand Down

0 comments on commit ce5dc7c

Please sign in to comment.