Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Decrypt(Span<byte> src, Span<byte> dst)
- {
- if (!Decrypt2)
- {
- for (int i = 0; i < src.Length; i++)
- {
- dst[i] = (byte)(src[i] ^ 0xAB);
- dst[i] = (byte)(dst[i] >> 4 | dst[i] << 4);
- dst[i] = (byte)(dst[i] ^ (_cryptKey2[_decryptCounter.Key2] ^ _cryptKey1[_decryptCounter.Key1]));
- _decryptCounter.Increment();
- }
- }
- else
- {
- for (int i = 0; i < src.Length; i++)
- {
- dst[i] = (byte)(src[i] ^ 0xAB);
- dst[i] = (byte)(dst[i] >> 4 | dst[i] << 4);
- dst[i] = (byte)(dst[i] ^ (_cryptKey4[_decryptCounter.Key2] ^ _cryptKey3[_decryptCounter.Key1]));
- _decryptCounter.Increment();
- }
- }
- }
- public void Encrypt(Span<byte> src, Span<byte> dst)
- {
- for (int i = 0; i < src.Length; i++)
- {
- dst[i] = (byte)(src[i] ^ 0xAB);
- dst[i] = (byte)(dst[i] >> 4 | dst[i] << 4);
- dst[i] = (byte)(dst[i] ^ (_cryptKey1[_encryptCounter.Key1] ^ _cryptKey2[_encryptCounter.Key2]));
- _encryptCounter.Increment();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement