/** * Creates an HMACT64 instance which uses the given secret key material. * * @param key The key material to use in hashing. */ public HMACT64(byte[] key) { super("HMACT64"); int length = Math.min(key.length, BLOCK_LENGTH); for (int i = 0; i < length; i++) { ipad[i] = (byte) (key[i] ^ IPAD); opad[i] = (byte) (key[i] ^ OPAD); } for (int i = length; i < BLOCK_LENGTH; i++) { ipad[i] = IPAD; opad[i] = OPAD; } try { md5 = MessageDigest.getInstance("MD5"); } catch (Exception ex) { throw new IllegalStateException(ex.getMessage()); } engineReset(); }
/** * Creates an HMACT64 instance which uses the given secret key material. * * @param key The key material to use in hashing. */ public HMACT64(byte[] key) { super("HMACT64"); int length = Math.min(key.length, BLOCK_LENGTH); for (int i = 0; i < length; i++) { ipad[i] = (byte) (key[i] ^ IPAD); opad[i] = (byte) (key[i] ^ OPAD); } for (int i = length; i < BLOCK_LENGTH; i++) { ipad[i] = IPAD; opad[i] = OPAD; } try { md5 = MessageDigest.getInstance("MD5"); } catch (Exception ex) { throw new IllegalStateException(ex.getMessage()); } engineReset(); }
/** * Creates an HMACT64 instance which uses the given secret key material. * * @param key The key material to use in hashing. */ public HMACT64(byte[] key) { super("HMACT64"); int length = Math.min(key.length, BLOCK_LENGTH); for (int i = 0; i < length; i++) { ipad[i] = (byte) (key[i] ^ IPAD); opad[i] = (byte) (key[i] ^ OPAD); } for (int i = length; i < BLOCK_LENGTH; i++) { ipad[i] = IPAD; opad[i] = OPAD; } try { md5 = MessageDigest.getInstance("MD5"); } catch (Exception ex) { throw new IllegalStateException(ex.getMessage()); } engineReset(); }
/** * Creates an HMACT64 instance which uses the given secret key material. * * @param key The key material to use in hashing. */ public HMACT64(byte[] key) { super("HMACT64"); int length = Math.min(key.length, BLOCK_LENGTH); for (int i = 0; i < length; i++) { ipad[i] = (byte) (key[i] ^ IPAD); opad[i] = (byte) (key[i] ^ OPAD); } for (int i = length; i < BLOCK_LENGTH; i++) { ipad[i] = IPAD; opad[i] = OPAD; } try { md5 = MessageDigest.getInstance("MD5"); } catch (Exception ex) { throw new IllegalStateException(ex.getMessage()); } engineReset(); }
/** * Creates an HMACT64 instance which uses the given secret key material. * * @param key * The key material to use in hashing. */ public HMACT64 ( byte[] key ) { super("HMACT64"); int length = Math.min(key.length, BLOCK_LENGTH); for ( int i = 0; i < length; i++ ) { this.ipad[ i ] = (byte) ( key[ i ] ^ IPAD ); this.opad[ i ] = (byte) ( key[ i ] ^ OPAD ); } for ( int i = length; i < BLOCK_LENGTH; i++ ) { this.ipad[ i ] = IPAD; this.opad[ i ] = OPAD; } this.md5 = Crypto.getMD5(); engineReset(); }
/** * Creates an HMACT64 instance which uses the given secret key material. * * @param key * The key material to use in hashing. */ public HMACT64 ( byte[] key ) { super("HMACT64"); int length = Math.min(key.length, BLOCK_LENGTH); for ( int i = 0; i < length; i++ ) { this.ipad[ i ] = (byte) ( key[ i ] ^ IPAD ); this.opad[ i ] = (byte) ( key[ i ] ^ OPAD ); } for ( int i = length; i < BLOCK_LENGTH; i++ ) { this.ipad[ i ] = IPAD; this.opad[ i ] = OPAD; } this.md5 = Crypto.getMD5(); engineReset(); }