//将8个byte数合并为一个ulong型数据 //Tested public static ulong BytToUlon(byte [] bytearray, int i) { ulong rtnlon; ulong rtnlon1 = bytearray[i]; ulong rtnlon2 = bytearray[i + 1]; ulong rtnlon3 = bytearray[i + 2]; ulong rtnlon4 = bytearray[i + 3]; ulong rtnlon5 = bytearray[i + 4]; ulong rtnlon6 = bytearray[i + 5]; ulong rtnlon7 = bytearray[i + 6]; ulong rtnlon8 = bytearray[i + 7]; rtnlon1 = RingShift.AbsoluteBit(rtnlon1 << 56, 56, 2); rtnlon2 = RingShift.AbsoluteBit(rtnlon2 << 48, 48, 2); rtnlon3 = RingShift.AbsoluteBit(rtnlon3 << 40, 40, 2); rtnlon4 = RingShift.AbsoluteBit(rtnlon4 << 32, 32, 2); rtnlon5 = RingShift.AbsoluteBit(rtnlon5 << 24, 24, 2); rtnlon6 = RingShift.AbsoluteBit(rtnlon6 << 16, 16, 2); rtnlon7 = RingShift.AbsoluteBit(rtnlon7 << 8, 8, 2); rtnlon8 = RingShift.AbsoluteBit(rtnlon8, 0, 2); rtnlon = rtnlon1 | rtnlon2 | rtnlon3 | rtnlon4 | rtnlon5 | rtnlon6 | rtnlon7 | rtnlon8; return(rtnlon); }
public static ulong CyclicShift4(ulong x) { rtnulon = RingShift.CyclicShift(x, 19) ^ RingShift.CyclicShift(x, 61) ^ RingShift.AbsoluteBit(x >> 6, 6, 1); return(rtnulon); }
//数据循环移位与移位后相与 public static ulong CyclicShift3(ulong x) { rtnulon = RingShift.CyclicShift(x, 1) ^ RingShift.CyclicShift(x, 8) ^ RingShift.AbsoluteBit(x >> 7, 7, 1); return(rtnulon); }
public static ulong CyclicShift2(ulong x) { rtnulon = RingShift.CyclicShift(x, 14) ^ RingShift.CyclicShift(x, 18) ^ RingShift.CyclicShift(x, 41); return(rtnulon); }
//数据仅循环移位后相与 public static ulong CyclicShift1(ulong x) { rtnulon = RingShift.CyclicShift(x, 28) ^ RingShift.CyclicShift(x, 34) ^ RingShift.CyclicShift(x, 39); return(rtnulon); }