Class MD5


  • public final class MD5
    extends Object

    Modifed version of Fast MD5 for Java 2.7.1 (from http://www.twmacinta.com/myjava/fast_md5.php) Modifications from the original source : - Removed native code support - Stripped some code - Removed wacky synchronization - Reformatted code to match Java and FFMQ standards

    This Java class has been derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm and its reference implementation.
    Author:
    Santeri Paavolainen , Timothy W Macinta (twm@alum.mit.edu) (optimizations and bug fixes)
    • Constructor Summary

      Constructors 
      Constructor Description
      MD5()
      Class constructor
    • Constructor Detail

      • MD5

        public MD5()
        Class constructor
    • Method Detail

      • reset

        public void reset()
        Reset MD5 internal state
      • update

        public void update​(byte[] buffer,
                           int offset,
                           int length)
        Updates hash with the bytebuffer given (using at maximum length bytes from that buffer)
        Parameters:
        buffer - Array of bytes to be hashed
        offset - Offset to buffer array
        length - Use at maximum `length' bytes (absolute maximum is buffer.length)
      • update

        public void update​(byte[] buffer)
        Updates hash with given array of bytes
        Parameters:
        buffer - Array of bytes to use for updating the hash
      • digest

        public byte[] digest()
        Returns array of bytes (16 bytes) representing hash as of the current state of this object. Note: getting a hash does not invalidate the hash object, it only creates a copy of the real state which is finalized.
        Returns:
        Array of 16 bytes, the hash of all updated bytes