Spring does have a not-well-known utility called DigestUtils who allows you to create md5 hashes easily. Here is an example:
import org.springframework.util.DigestUtils; public class Example { public static void main( String[] args ) { System.out.println( DigestUtils.md5DigestAsHex( "Hello world".getBytes() ) ); } // main }
However, bear in mind that the javadoc says that “Mainly for internal use within the framework; consider Apache Commons Codec for a more comprehensive suite of digest utilities”.