List of utility methods to do MD5
int | md5_hh(int C, int B, int G, int F, int A, int E, int D) mhh return md5_cmn(B ^ G ^ F, C, B, A, E, D);
|
String | md5_id(byte[] md5digest) mid StringBuilder hashbuf = new StringBuilder(md5digest.length * 2); for (byte b : md5digest) { int intVal = b & 0xff; if (intVal < 0x10) { hashbuf.append("0"); hashbuf.append(Integer.toHexString(intVal)); return hashbuf.toString().toLowerCase(); |
String | md5bytesToHex(byte[] md5) mdbytes To Hex StringBuilder sb = new StringBuilder(); for (byte aMd5 : md5) { sb.append(Integer.toString((aMd5 & 0xff) + 0x100, 16).substring(1)); return sb.toString(); |
String | md5Encode(byte[] content) md Encode return DatatypeConverter.printBase64Binary(content);
|
String | md5Encode(String strIn) Compute the MD5 of the given string and return it as a Base64-encoded value. try { MessageDigest md5 = MessageDigest.getInstance("md5"); byte[] bin = toBytes(strIn); byte[] bout = md5.digest(bin); String strOut = javax.xml.bind.DatatypeConverter.printBase64Binary(bout); return strOut; } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); ... |
String | md5HashByteToString(byte[] bytes) Creates an MD5 string from the given bytes. String result = ""; for (int i = 0; i < bytes.length; i++) { result += Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1); return result; |
byte[] | md5HashStringToByte(String hash) Creates an MD5 byte array from the given MD5 hash. byte[] buf = new byte[16]; int i = 0; while (hash.length() > 0) { buf[i++] = (byte) Integer.parseInt(hash.substring(0, 2), 16); hash = hash.substring(2); return buf; |
String | md5Hex(final String text) md Hex try { final byte[] bytesOfMessage = text.getBytes("UTF-8"); final MessageDigest md = MessageDigest.getInstance("MD5"); final byte[] digest = md.digest(bytesOfMessage); return DatatypeConverter.printHexBinary(digest).toLowerCase(); } catch (Exception e) { throw new RuntimeException(); |
void | md5Init() md Init count[0] = 0L;
count[1] = 0L;
state[0] = 0x67452301L;
state[1] = 0xefcdab89L;
state[2] = 0x98badcfeL;
state[3] = 0x10325476L;
return;
|
void | md5Memcpy(byte[] output, byte[] input, int outpos, int inpos, int len) md Memcpy int i; for (i = 0; i < len; i++) output[outpos + i] = input[inpos + i]; |