private String algorithm = ALGO_MD5;
public String generate(byte[] input) throws OAuthServiceException {
if (input == null) {
throw new OAuthServiceException("You have to pass input to Token Generator");
}
try {
byte[] messageDigest = createDigest(input, algorithm);
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < messageDigest.length; i++) {
hexString.append(Integer.toHexString(0xFF & messageDigest[i]));
}
return hexString.toString();
} catch (NoSuchAlgorithmException e) {
throw new OAuthServiceException("server_error", e);
}
}