Skip to content

Instantly share code, notes, and snippets.

@HootsuiteJosh
Created November 17, 2017 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HootsuiteJosh/2f6dee3d7fb39464767580af79973ae5 to your computer and use it in GitHub Desktop.
Save HootsuiteJosh/2f6dee3d7fb39464767580af79973ae5 to your computer and use it in GitHub Desktop.
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.digest.DigestUtils;
// ...
public String computeHash(String uId, String ts, String secret) {
byte[] digest = DigestUtils.sha512(uId + ts + secret);
char[] hex = Hex.encodeHex(digest);
return new String(hex);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment