mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
优化MD5性能
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package cn.hutool.crypto.digest;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.thread.ConcurrencyTester;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -17,4 +19,15 @@ public class Md5Test {
|
||||
Assert.assertEquals(16, hex16.length());
|
||||
Assert.assertEquals("cb143acd6c929826", hex16);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void md5ThreadSafeTest() {
|
||||
final String text = "Hutool md5 test str";
|
||||
final ConcurrencyTester tester = new ConcurrencyTester(1000);
|
||||
tester.test(()->{
|
||||
final String digest = new MD5().digestHex(text);
|
||||
Assert.assertEquals("8060075dd8df47bac3247438e940a728", digest);
|
||||
});
|
||||
IoUtil.close(tester);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user