ami.security
Class AMIHash

java.lang.Object
  |
  +--ami.security.AMIHash

public class AMIHash
extends Object

This classes provides some hashing code. It contains mainly an implementation of MD5 algorithm and some other trivial hashing methods. The implementation follows RFC 1321 and passes all RFC 1321 tests.

Version:
1.0
Author:
Bertrand Florat

Field Summary
private static char[] hex
           
 
Constructor Summary
AMIHash()
           
 
Method Summary
static byte[] hash(byte[] bIn)
          MD5 hashcoding, return a hashcode for the given string Follows RFC 1321
static byte[] hash64(byte[] bIn)
          Trivial hashing for AMI passphrase in order to get a 64 bits password
private static int op(int iType, int a, int b, int c, int d, int x_k, int s, int t_i)
          MD5 internal function
private static int rcl(int i, int j)
          Left rotation ( <<< )
static String toHex(byte[] b)
          Get a string hexa representation for a byte array
private static int unsignedAdd(int i1, int i2)
          Non-signed addition. ints are signed, use long instead before computing and come back to int after
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

hex

private static final char[] hex
Constructor Detail

AMIHash

public AMIHash()
Method Detail

hash

public static final byte[] hash(byte[] bIn)
MD5 hashcoding, return a hashcode for the given string Follows RFC 1321
Parameters:
bIn - input byte array
Returns:
hashed output as byte array

op

private static int op(int iType,
                      int a,
                      int b,
                      int c,
                      int d,
                      int x_k,
                      int s,
                      int t_i)
MD5 internal function

rcl

private static int rcl(int i,
                       int j)
Left rotation ( <<< )

unsignedAdd

private static int unsignedAdd(int i1,
                               int i2)
Non-signed addition. ints are signed, use long instead before computing and come back to int after

toHex

public static String toHex(byte[] b)
Get a string hexa representation for a byte array

hash64

public static final byte[] hash64(byte[] bIn)
Trivial hashing for AMI passphrase in order to get a 64 bits password