List of utility methods to do SHA256
String | sha256(String string, String secret) sha try { SecretKeySpec signingKey = new SecretKeySpec(secret.getBytes(), "HmacSHA256"); final Mac mac = Mac.getInstance("HmacSHA256"); mac.init(signingKey); byte[] digest = mac.doFinal(string.getBytes("UTF-8")); digest = mac.doFinal(string.getBytes()); BigInteger bigInteger = new BigInteger(1, digest); return String.format("%0" + (digest.length << 1) + "x", bigInteger); ... |
String | sha256(String strSrc) sha return Encrypt(strSrc, "SHA-256"); |
String | SHA256(String text) SHA MessageDigest md; md = MessageDigest.getInstance("SHA-256"); md.update(text.getBytes("iso-8859-1"), 0, text.length()); byte[] sha256hash = md.digest(); return convertToHex(sha256hash); |
byte[] | SHA256(String text) SHA try { MessageDigest md; md = MessageDigest.getInstance("SHA-256"); md.update(text.getBytes("UTF-8"), 0, text.length()); return md.digest(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } catch (UnsupportedEncodingException e) { ... |
String | sha256(String text) sha MessageDigest md = MessageDigest.getInstance("SHA-256"); return toHex(md.digest(text.getBytes())); |
String | SHA256(String texto) SHA String sen = ""; MessageDigest md = null; try { md = MessageDigest.getInstance("SHA-256"); BigInteger hash = new BigInteger(1, md.digest(texto.getBytes())); sen = hash.toString(16); } catch (NullPointerException e) { e.printStackTrace(); ... |
String | SHA256Binary(String toHash) This SHA256 function returns a 256-character binary String representing the full SHA256 hash of the String toHash This binary String is useful when signing a message with a Lamport Signature. try { byte[] messageHash = md.digest(toHash.getBytes("UTF-8")); return new BigInteger(1, messageHash).toString(2); } catch (Exception e) { e.printStackTrace(); return null; |
byte[] | SHA256byte(String input) SH Abyte try { MessageDigest md = MessageDigest.getInstance(ALGORITHM_SHA256); return md.digest(input.getBytes()); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); |
byte[] | sha256digest(@Nonnull byte[] data) Simple utility to calculate the SHA-256 digest. MessageDigest digest; try { digest = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new Error(e); return digest.digest(data); |
byte[] | sha256Digest(byte[] bytes) sha Digest return digest(SHA256_ALGORITHM_NAME, bytes);
|