mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-07-16 01:11:40 +08:00
Eliminate byte[] allocation in RC4
This commit is contained in:
parent
fba5b60718
commit
ce5dc7c1a1
@ -7,7 +7,7 @@
|
|||||||
public static byte[] Encrypt(ReadOnlySpan<byte> key, ReadOnlySpan<byte> data)
|
public static byte[] Encrypt(ReadOnlySpan<byte> key, ReadOnlySpan<byte> data)
|
||||||
{
|
{
|
||||||
// Key-scheduling algorithm
|
// Key-scheduling algorithm
|
||||||
var s = new byte[256];
|
Span<byte> s = stackalloc byte[256];
|
||||||
for (var i = 0; i < 256; i++)
|
for (var i = 0; i < 256; i++)
|
||||||
{
|
{
|
||||||
s[i] = (byte)i;
|
s[i] = (byte)i;
|
||||||
|
Loading…
Reference in New Issue
Block a user