edu.washington.cs.rfid.security
Class KeyHash

java.lang.Object
  extended by edu.washington.cs.rfid.security.KeyHash

public class KeyHash
extends java.lang.Object

Implements algorithms to hash String keys to longs.

Author:
Evan

Constructor Summary
KeyHash()
           
 
Method Summary
static long hash64(java.lang.String k, long initval)
          Hashes a String to a 64-bit number.
static long hashMD5(java.lang.String k)
          Returns the long result of the first 64 bits of an MD5 hash XOR'd with the last 64 bits.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyHash

public KeyHash()
Method Detail

hash64

public static long hash64(java.lang.String k,
                          long initval)
Hashes a String to a 64-bit number.

Parameters:
k - The String key
initval - An initial value
Returns:
The 64-bit hash

hashMD5

public static long hashMD5(java.lang.String k)
Returns the long result of the first 64 bits of an MD5 hash XOR'd with the last 64 bits.

Parameters:
k - The key to hash
Returns:
The XOR'd hash as a long