Class MD5


  • public class MD5
    extends java.lang.Object
    Convenience class for hashing a String with MD5, and either returning an int with the 4 LSBytes, or the whole 12-byte MD5 hash.

    Note that instantiating this class can be expensive, so re-using instances is a good idea.

    This class is not thread safe.

    Author:
    Einar M R Rosenvinge
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.ThreadLocal<java.security.MessageDigest> md5  
    • Constructor Summary

      Constructors 
      Constructor Description
      MD5()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int hash​(java.lang.String s)  
      byte[] hashFull​(java.lang.String s)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • md5

        public static final java.lang.ThreadLocal<java.security.MessageDigest> md5
    • Constructor Detail

      • MD5

        public MD5()
    • Method Detail

      • hash

        public int hash​(java.lang.String s)
      • hashFull

        public byte[] hashFull​(java.lang.String s)