List of utility methods to do SHA256
byte[] | sha256(String message) sha MessageDigest md = MessageDigest.getInstance(SHA256);
return md.digest(stringToBytes(message));
|
String | sha256(String password, String salt) sha MessageDigest digest = MessageDigest.getInstance("SHA-256"); digest.reset(); digest.update(salt.getBytes()); byte[] mdbytes = digest.digest(password.getBytes("UTF-8")); StringBuffer hexString = new StringBuffer(); for (int i = 0; i < mdbytes.length; i++) { hexString.append(Integer.toHexString(0xFF & mdbytes[i])); return hexString.toString(); |
String | sha256(String plainText) sha String salt = "qwertyuiop!@#$%^&*()zxcvbnm,."; String sha256Text = null; if (plainText != null) { try { MessageDigest sha256 = MessageDigest.getInstance("SHA-256"); sha256.update(salt.getBytes()); byte[] byteArray = plainText.getBytes(); byte[] sha256Bytes = sha256.digest(byteArray); ... |
String | sha256(String raw) sha return digest(raw, "SHA-256"); |
String | sha256(String s) sha MessageDigest md = getMessageDigest("sha-256"); return bytes2HexString(md.digest(s.getBytes(StandardCharsets.UTF_8))); |
String | sha256(String src) Calculates the SHA-256 digest and returns the value as a 64 character hex string. try { md = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); md.update(src.getBytes(StandardCharsets.UTF_8)); return String.format("%064x", new BigInteger(1, md.digest())); |
String | sha256(String srcStr) sha return hash("SHA-256", srcStr); |
String | sha256(String str) sha try { MessageDigest md = MessageDigest.getInstance("SHA-256"); md.update(str.getBytes()); byte[] b = md.digest(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < b.length; i++) { int v = (int) b[i]; v = v < 0 ? 0x100 + v : v; ... |
String | sha256(String str) sha String SHA = ""; try { MessageDigest sh = MessageDigest.getInstance("SHA-256"); sh.update(str.getBytes()); byte byteData[] = sh.digest(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < byteData.length; i++) { sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1)); ... |
byte[] | sha256(String string) sha MessageDigest digest; try { digest = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException ex) { throw new RuntimeException(ex.getMessage(), ex); return digest.digest(string.getBytes(StandardCharsets.UTF_8)); |