You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package me.zhengjie.utils;
|
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
import static org.junit.Assert.*;
|
|
|
|
import static me.zhengjie.utils.EncryptUtils.*;
|
|
|
|
|
|
|
|
public class EncryptUtilsTest {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 对称加密
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void testDesEncrypt() {
|
|
|
|
|
|
|
|
try {
|
|
|
|
desEncrypt("baiye2022");
|
|
|
|
assertEquals("7772841DC6099402", desEncrypt("123456"));
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 对称解密
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void testDesDecrypt() {
|
|
|
|
try {
|
|
|
|
assertEquals("123456", desDecrypt("7772841DC6099402"));
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|