Guest User

Untitled

a guest
Nov 30th, 2022
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.34 KB | None | 0 0
  1. public static byte[] getXOR(byte[] data) {
  2.         byte[] xorBytes = new byte[2];
  3.         int s1 = 0;
  4.         int s2 = 0;
  5.         for (byte b : data) {
  6.             s1 = (s1 ^ b);
  7.             s2 = Integer.rotateRight(s2, 1) ^ b;
  8.         }
  9.         xorBytes[0] = (byte) (s1);
  10.         xorBytes[1] = (byte) (s2);
  11.         return xorBytes;
  12.     }
Advertisement
Add Comment
Please, Sign In to add comment