org.axonframework.common.digest
Class Digester

java.lang.Object
  extended by org.axonframework.common.digest.Digester

public final class Digester
extends Object

Utility class for generating hashes for values using several algorithms. It uses the MessageDigest as underlying mechanism.

Since:
2.0
Author:
Allard Buijze

Method Summary
 String digestHex()
          Returns the hex representation of the digest of all data that has been provided so far.
static String md5Hex(String input)
          Utility method that creates a hex string of the MD5 hash of the given input
static Digester newInstance(String algorithm)
          Creates a new Digester instance for the given algorithm.
static Digester newMD5Instance()
          Creates a new Digester instance for the MD5 Algorithm
 Digester update(byte[] additionalData)
          Update the Digester with given additionalData.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newInstance

public static Digester newInstance(String algorithm)
Creates a new Digester instance for the given algorithm.

Parameters:
algorithm - The algorithm to use, e.g. "MD5"
Returns:
a fully initialized Digester instance

newMD5Instance

public static Digester newMD5Instance()
Creates a new Digester instance for the MD5 Algorithm

Returns:
a Digester instance to create MD5 hashes

md5Hex

public static String md5Hex(String input)
Utility method that creates a hex string of the MD5 hash of the given input

Parameters:
input - The value to create a MD5 hash for
Returns:
The hex representation of the MD5 hash of given input

update

public Digester update(byte[] additionalData)
Update the Digester with given additionalData.

Parameters:
additionalData - The data to add to the digest source
Returns:
this for method chaining

digestHex

public String digestHex()
Returns the hex representation of the digest of all data that has been provided so far.

Returns:
the hex representation of the digest of all data that has been provided so far
See Also:
update(byte[])


Copyright © 2010-2016. All Rights Reserved.