Skip to content

Instantly share code, notes, and snippets.

@shazinahmed
Created August 27, 2012 02:58
Show Gist options
  • Save shazinahmed/3485195 to your computer and use it in GitHub Desktop.
Save shazinahmed/3485195 to your computer and use it in GitHub Desktop.
url2png md5 hash token generation code
public byte[] generateToken(String url,String apiKey) throws NoSuchAlgorithmException{
MessageDigest md = MessageDigest.getInstance("MD5");// throws NoSuchAlgorithmException
StringBuffer buffer = new StringBuffer(url);
buffer.append(apiKey);//prepare the string to be hashed url+APIKey
byte[] token = md.digest(buffer.toString().getBytes());
return token ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment