Skip to content

Instantly share code, notes, and snippets.

@creeek
creeek / gist:dfd0716d04527869a7d5
Created February 29, 2016 08:17 — forked from selaromi/gist:e6f253d739bb31c95853
SHA256 in Java Ruby C# PHP Phython
*SHA256–Bit Hash Java Example*
import java.security.MessageDigest;
import java.security.SignatureException;
String sourceString = ...; // shared secret + fields in correct format
String hash = sha256Digest(sourceString);
public String sha256Digest (String data) throws SignatureException {
return getDigest(“SHA-256”, data, true);
}