Package gnu.crypto.hash

Examples of gnu.crypto.hash.IMessageDigest


    for (int n = 0; n < numNodes; n++) {
      batchLists[n] = new ArrayList<BatchElement>();
    }

    IMessageDigest md = HashFactory.getInstance("RIPEMD-160");
    CLBuffer clBuffer = CLBuffer.create();

    byte[] buf = new byte[512]// for holding set and key

    int setOffset = 0;
    int setLen = CLBuffer.stringToUtf8(set, buf, setOffset);
    int keyOffset = setLen + 1;

    // Create the digests for all the keys passed in.
    Iterator<Object> keysIterator = keys.iterator();

    for (int i = 0; keysIterator.hasNext(); i++) {
      Object key = keysIterator.next();
      int keyLen = clBuffer.keyToBytes(key, buf, keyOffset);

      md.reset();
      md.update(buf, setOffset, setLen);
      md.update(buf, keyOffset, keyLen);

      byte[] digest = md.digest();
      long partitionId = CLBuffer.get_ntohl_intel(digest, 0);

      // Can't use mod directly - mod will give negative numbers. First
      // bitwise-and determines positive/negative correctly, then mod.
      partitionId = (partitionId & 0xFFFF) %
View Full Code Here


    for (int n = 0; n < numNodes; n++) {
      batchLists[n] = new ArrayList<BatchElement>();
    }

    IMessageDigest md = HashFactory.getInstance("RIPEMD-160");
    CLBuffer clBuffer = CLBuffer.create();
    ArrayList<byte[]> allDigests = new ArrayList<byte[]>(numKeys);

    byte[] buf = new byte[512]// for holding set and key

    int setOffset = 0;
    int setLen = CLBuffer.stringToUtf8(set, buf, setOffset);
    int keyOffset = setLen + 1;

    // Create the digests for all the keys passed in.
    Iterator<Object> keysIterator = keys.iterator();

    for (int i = 0; keysIterator.hasNext(); i++) {
      Object key = keysIterator.next();
      int keyLen = clBuffer.keyToBytes(key, buf, keyOffset);

      md.reset();
      md.update(buf, setOffset, setLen);
      md.update(buf, keyOffset, keyLen);

      byte[] digest = md.digest();

      allDigests.add(digest);

      long partitionId = CLBuffer.get_ntohl_intel(digest, 0);
View Full Code Here

TOP

Related Classes of gnu.crypto.hash.IMessageDigest

Copyright © 2018 www.massapicom. 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.