User Tools

Site Tools


Create a md5 hash in java with eclipse

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”.

java/createmd5hashinjavawithspring.txt · Last modified: 2022/12/02 22:02 by