Examples of EndianReader


Examples of at.orz.hash.EncodeUtils.EndianReader

  private static final int PRIME4 = 668265263;
  private static final int PRIME5 = 0x165667b1;
 
  public static int digestSmall(byte[] data, int seed, boolean bigendian) {
   
    final EndianReader er = bigendian ? EncodeUtils.BEReader : EncodeUtils.LEReader;
    final int len = data.length;
    final int bEnd = len;
    final int limit = bEnd - 4;
   
    int idx = seed + PRIME1;
    int crc = PRIME5;
    int i = 0;
   
    while (i < limit) {
      crc += er.toInt(data, i) + (idx++);
      crc += Integer.rotateLeft(crc, 17) * PRIME4;
      crc *= PRIME1;
      i += 4;
    }
   
View Full Code Here

Examples of at.orz.hash.EncodeUtils.EndianReader

   
    if (len < 16) {
      return digestSmall(data, seed, bigendian);
    }
   
    final EndianReader er = bigendian ? EncodeUtils.BEReader : EncodeUtils.LEReader;
    final int bEnd = len;
    final int limit = bEnd - 16;
    int v1 = seed + PRIME1;
    int v2 = v1 * PRIME2 + len;
    int v3 = v2 * PRIME3;
    int v4 = v3 * PRIME4;
   
    int i = 0;
    int crc = 0;
    while (i < limit) {
      v1 = Integer.rotateLeft(v1, 13) + er.toInt(data, i);
      i += 4;
      v2 = Integer.rotateLeft(v2, 11) + er.toInt(data, i);
      i += 4;
      v3 = Integer.rotateLeft(v3, 17) + er.toInt(data, i);
      i += 4;
      v4 = Integer.rotateLeft(v4, 19) + er.toInt(data, i);
      i += 4;
    }
   
    i = bEnd - 16;
    v1 += Integer.rotateLeft(v1, 17);
    v2 += Integer.rotateLeft(v2, 19);
    v3 += Integer.rotateLeft(v3, 13);
    v4 += Integer.rotateLeft(v4, 11);
   
    v1 *= PRIME1;
    v2 *= PRIME1;
    v3 *= PRIME1;
    v4 *= PRIME1;
   
    v1 += er.toInt(data, i);
    i += 4;
    v2 += er.toInt(data, i);
    i += 4;
    v3 += er.toInt(data, i);
    i += 4;
    v4 += er.toInt(data, i);
   
    v1 *= PRIME2;
    v2 *= PRIME2;
    v3 *= PRIME2;
    v4 *= PRIME2;
View Full Code Here

Examples of at.orz.hash.EncodeUtils.EndianReader

   
    if (len < 16) {
      return digestSmall(data, seed, bigendian);
    }
   
    final EndianReader er = bigendian ? EncodeUtils.BEReader : EncodeUtils.LEReader;
    final int bEnd = len;
    final int limit = bEnd - 16;
    int v1 = seed + PRIME1;
    int v2 = v1 * PRIME2 + len;
    int v3 = v2 * PRIME3;
    int v4 = v3 * PRIME4;
   
    int i = 0;
    int crc = 0;
   
    while (i < limit) {
      v1 += Integer.rotateLeft(v1, 13);
      v1 *= PRIME1;
      v1 += er.toInt(data, i);
      i += 4;

      v2 += Integer.rotateLeft(v2, 11);
      v2 *= PRIME1;
      v2 += er.toInt(data, i);
      i += 4;

      v3 += Integer.rotateLeft(v3, 17);
      v3 *= PRIME1;
      v3 += er.toInt(data, i);
      i += 4;

      v4 += Integer.rotateLeft(v4, 19);
      v4 *= PRIME1;
      v4 += er.toInt(data, i);
      i += 4;

    }
   
    i = bEnd - 16;
    v1 += Integer.rotateLeft(v1, 17);
    v2 += Integer.rotateLeft(v2, 19);
    v3 += Integer.rotateLeft(v3, 13);
    v4 += Integer.rotateLeft(v4, 11);
   
    v1 *= PRIME1;
    v2 *= PRIME1;
    v3 *= PRIME1;
    v4 *= PRIME1;
   
    v1 += er.toInt(data, i);
    i += 4;
    v2 += er.toInt(data, i);
    i += 4;
    v3 += er.toInt(data, i);
    i += 4;
    v4 += er.toInt(data, i);
   
    v1 *= PRIME2;
    v2 *= PRIME2;
    v3 *= PRIME2;
    v4 *= PRIME2;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.