pom.xml
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
使用方法
import org.apache.commons.codec.digest.DigestUtils;
public static void main(String args[]) throws Exception {
String str = "lxyoucan";
System.out.println("原始 :"+str);
System.out.println("commons-codec:"+ DigestUtils.sha1Hex(str));
}