Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public enum Alignment { Left = 0, Right = 1 }
- public static byte[] Xor(this byte[] arr1, byte[] arr2, Alignment alignment = Alignment.Left)
- {
- if (arr1.Length < arr2.Length) { byte[] ba = arr1; arr1 = arr2; arr2 = ba; }
- byte[] result = new byte[arr1.Length];
- if (alignment == Alignment.Left) Array.Copy(arr2, 0, result, 0, arr2.Length);
- else Array.Copy(arr2, 0, result, arr1.Length - arr2.Length, arr2.Length);
- for (int i = 0; i < arr1.Length; i++) result[i] ^= arr1[i];
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement