I have the following PHP function which generates tokens. It uses md5 hashing algorithm and mcrypt_create_iv in the following manner.
public static function generate_token($length = 32)
{
$char_str = strtoupper(md5(mcrypt_create_iv($length, MCRYPT_DEV_URANDOM)));
$token = substr($char_str, 0, $length);
return $token;
}
I want to perform the same task in Java. But I am not sure which libraries to use.