List of utility methods to do SHA256
byte[] | digestSHA256(byte[] input) Performs a final update on the digest using the specified array of bytes, then completes the digest computation. MessageDigest digestEngine = MessageDigest.getInstance("SHA-256"); return digestEngine.digest(input); |
String | digestSha256(String plain) digest Sha try { return digest(plain, "SHA-256"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); |
byte[] | digestSha256(String value) Parses a string and returns a SHA-256 checksum of it. final MessageDigest algorithm; try { algorithm = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); return algorithm.digest(value.getBytes()); |
String | getSHA256(String input) get SHA try { return DatatypeConverter.printHexBinary(md.digest(input.getBytes("UTF-8"))); } catch (UnsupportedEncodingException e) { System.err.println("[CRITICAL] UTF-8 ENCODING NOT SUPPORTED. EXITING."); System.exit(-1); return "ERROR"; |
MessageDigest | sha256() sha try { return MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException(e); |
byte[] | sha256(byte[] bytes) sha return MessageDigest.getInstance("SHA-256").digest(bytes); |
byte[] | sha256(byte[] data) sha return sha256(data, 0, data.length);
|
String | sha256(byte[] data) Compute a SHA-256 hash using Java built-in MessageDigest, and format the result in hex. try { MessageDigest md = MessageDigest.getInstance("sha-256", "SUN"); byte[] sign = md.digest(data); return arraytohexstring(sign); } catch (NoSuchAlgorithmException | NoSuchProviderException imp) { throw new RuntimeException(imp); |
byte[] | SHA256(byte[] input) SHA return sha256.digest(input);
|
String | SHA256(byte[] P) SHA try { MessageDigest SIG = MessageDigest.getInstance("SHA-256"); SIG.update(P, 0, P.length); byte D[] = SIG.digest(); return getHexString(D); } catch (java.security.NoSuchAlgorithmException e) { throw new RuntimeException(e); |