标签:env test cti pre java repos pid bsp ring
需要引入org.apache.commons.codec.digest.DigestUtils这个包,pom.xml文件配置如下:
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec --> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>1.10</version> </dependency>
demo代码如下:
@Test public void givenPassword_whenHashingUsingCommons_thenVerifying() { String hash = "35454B055CC325EA1AF2126E27707052"; String password = "ILoveJava"; String md5Hex = DigestUtils .md5Hex(password).toUpperCase(); assertThat(md5Hex.equals(hash)).isTrue(); }
标签:env test cti pre java repos pid bsp ring
原文地址:http://www.cnblogs.com/jwentest/p/7066694.html