%bte.doc super="item.bte" %> <%bte.tpl name=pageTitle%>MD5<%/bte.tpl%> <%bte.tpl name=description%>Generate MD5 hash sums.<%/bte.tpl%> <%bte.tpl name=keywords%>md5, md5 hash generator, md5 checksum, md5 library, java md5, check sum md5, message digest, fingerprint md5, signature md5, md5 input stream, md5inputstream, md5 output stream, md5outputstream<%/bte.tpl%> <%bte.tpl name=content%>
System.out.println( MD5.getHashString( "Hello World" ) );
This class takes as input a message of arbitrary length and produces as output a 128-bit "fingerprint" or "message digest" of the input. It is conjectured that it is computationally infeasible to produce two messages having the same message digest, or to produce any message having a given pre-specified target message digest. The MD5 algorithm is intended for digital signature applications, where a large file must be "compressed" in a secure manner before being encrypted with a private (secret) key under a public-key cryptosystem such as RSA.
This class is based on work by Santeri Paavolainen. and RFC1321. This implementation is several times faster and much more memory efficient than Santeri's implementation.
[Download /w Source | Version History | Browse Source | Documentation]
// Print the MD5 hash for a line // read from standard input MD5InputStream in = new MD5InputStream(System.in); int b; while ((b = in.read()) != -1 && b != '\r' && b != '\n'); System.out.println(in.getHashString());
A filtered input stream that computes an MD5 sum for anything read.
[Download /w Source | Version History | Browse Source | Documentation]
// Write out hello world // and print its MD5 hash MD5OutputStream out = new MD5OutputStream(System.out); out.write("Hello World\n".getBytes()); System.out.println(out.getHashString());
A filtered output stream that computes an MD5 sum for anything written.
[Download /w Source | Version History | Browse Source | Documentation]