List of utility methods to do SHA1 Hash Create
String | sha1(String ori) sha try { MessageDigest md = MessageDigest.getInstance("sha1"); md.update(ori.getBytes(), 0, ori.length()); BigInteger i = new BigInteger(1, md.digest()); return String.format("%1$040x", i); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return ori; ... |
String | sha1(String ori) sha try { MessageDigest md = MessageDigest.getInstance("sha1"); md.update(ori.getBytes(), 0, ori.length()); BigInteger i = new BigInteger(1, md.digest()); return String.format("%1$040x", i); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return ori; ... |
String | sha1(String s) SHA1 algorithm return encrypt(s, "SHA-1"); |
String | sha1(String s) sha return hash(s, "SHA1"); |
String | computeHashSHA1(final String text) Returns a hash value for a string using SHA-1 algorithm MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update(text.getBytes(), 0, text.length()); byte hashData[] = md.digest(); StringBuilder sb = new StringBuilder(hashData.length * 2); for (int i = 0; i < hashData.length; i++) { int b = (0xFF & hashData[i]); if (b <= 0xF) sb.append('0'); ... |
String | computeSHAHash(String password) compute SHA Hash MessageDigest digest = null; try { digest = MessageDigest.getInstance("SHA-1"); } catch (Exception e) { e.printStackTrace(); digest.reset(); byte[] data = digest.digest(password.getBytes()); ... |
String | getSHA1CertFingerprint(Context ctx) get SHA Cert Fingerprint try { Signature[] sigs = ctx.getPackageManager().getPackageInfo( ctx.getPackageName(), PackageManager.GET_SIGNATURES).signatures; if (sigs.length == 0) { return "ERROR: NO SIGNATURE."; } else if (sigs.length > 1) { return "ERROR: MULTIPLE SIGNATURES"; byte[] digest = MessageDigest.getInstance("SHA1").digest( sigs[0].toByteArray()); StringBuilder hexString = new StringBuilder(); for (int i = 0; i < digest.length; ++i) { if (i > 0) { hexString.append(":"); byteToString(hexString, digest[i]); return hexString.toString(); } catch (PackageManager.NameNotFoundException ex) { ex.printStackTrace(); return "(ERROR: package not found)"; } catch (NoSuchAlgorithmException ex) { ex.printStackTrace(); return "(ERROR: SHA1 algorithm not found)"; |
String | SHA1(String text) Converts a String into a SHA-1 hash. return hashAlgorithm("SHA-1", text); |
byte[] | shaByte(String in) Returns a byte array representation of the hash of a string input using the SHA1 hashing algorithm. return digestByte("SHA", in.getBytes()); |
byte[] | shaByte(byte[] in) Returns a byte array representation of the hash of a byte array input using the SHA1 hashing algorithm. return digestByte("SHA", in); |