List of utility methods to do Hash Code Calculate
String | generateHash(String item) generate Hash String generatedPassword = null; try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(item.getBytes()); byte[] bytes = md.digest(); generatedPassword = ByteArrayToString(bytes); } catch (NoSuchAlgorithmException e) { throw new NoSuchAlgorithmException(e); ... |
String | generateHash(String plaintext) generate Hash try { StringBuilder hash = new StringBuilder(); MessageDigest sha = MessageDigest.getInstance("SHA-1"); byte[] hashedBytes = sha.digest(plaintext.getBytes()); char[] digits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; for (int idx = 0; idx < hashedBytes.length; ++idx) { byte b = hashedBytes[idx]; hash.append(digits[(b & 0xf0) >> 4]); ... |
String | generateHash(String plainText, String hashType) generate Hash MessageDigest md = MessageDigest.getInstance(hashType); byte[] data = plainText.getBytes(); md.update(data); byte[] digest = md.digest(); return byteArrayToString(digest).toUpperCase(); |
String | generateHash(String serviceUri, String username, String password) generate Hash StringBuilder hashkey = new StringBuilder(); String hash = null; hashkey.append(serviceUri); hashkey.append(username); hashkey.append(password); try { MessageDigest sha = MessageDigest.getInstance("SHA-1"); sha.reset(); ... |
String | generateHash(String target) generate Hash if (target != null) { String hash = null; try { MessageDigest md = MessageDigest.getInstance("MD5"); byte[] bytes = md.digest(target.getBytes()); StringBuffer buff = new StringBuffer(); for (int l = 0; l < bytes.length; l++) { String hx = Integer.toHexString(0xFF & bytes[l]); ... |
String | generateHash(String tcString) Generates a SHA-1 hashcode from the input try { MessageDigest loMD = MessageDigest.getInstance("SHA1"); loMD.reset(); byte[] laBuffer = tcString.getBytes(); loMD.update(laBuffer); byte[] laDigest = loMD.digest(); StringBuffer loReturn = new StringBuffer(""); for (int i = 0, lnLength = laDigest.length; i < lnLength; i++) { ... |
String | generateHashSalt(int length) Generates a string of random alphanumeric characters of the given length. SecureRandom random = new SecureRandom(); StringBuffer salt = new StringBuffer(length); for (int i = 0; i < length; i++) salt.append(chars[random.nextInt(chars.length)]); return salt.toString(); |
UUID | generateHashUUID(String digestData) generate Hash UUID MessageDigest md5; try { md5 = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException exception) { return UUID.randomUUID(); md5.update(digestData.getBytes()); byte[] data = md5.digest(); ... |
int | hashCode(boolean b) hash Code return b ? 1231 : 1237;
|
int | hashCode(boolean b) hash Code return b ? Boolean.TRUE.hashCode() : Boolean.FALSE.hashCode();
|