Looly 5 years ago
parent
commit
8319b00918
1 changed files with 20 additions and 0 deletions
  1. 20 0
      hutool-crypto/src/test/java/cn/hutool/crypto/test/AESTest.java

+ 20 - 0
hutool-crypto/src/test/java/cn/hutool/crypto/test/AESTest.java

@@ -0,0 +1,20 @@
+package cn.hutool.crypto.test;
+
+import cn.hutool.crypto.Mode;
+import cn.hutool.crypto.Padding;
+import cn.hutool.crypto.symmetric.AES;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class AESTest {
+
+	@Test
+	public void encryptTest() {
+		// 构建
+		AES aes = new AES(Mode.CBC, Padding.PKCS5Padding,
+				"1234567890123456".getBytes(), "1234567890123456".getBytes());
+		String encryptHex = aes.encryptHex("123456");
+		Assert.assertEquals("d637735ae9e21ba50cb686b74fab8d2c", encryptHex);
+	}
+
+}