mirror of
https://github.com/ZSCNetSupportDept/WechatTicketSystem.git
synced 2025-10-29 16:14:16 +08:00
28 lines
704 B
Java
28 lines
704 B
Java
package love.sola.netsupport.wechat;
|
|
|
|
import love.sola.netsupport.util.RSAUtil;
|
|
import org.junit.Test;
|
|
import org.mindrot.jbcrypt.BCrypt;
|
|
|
|
/**
|
|
* ***********************************************
|
|
* Created by Sola on 2015/12/6.
|
|
* Don't modify this source without my agreement
|
|
* ***********************************************
|
|
*/
|
|
public class TestEncrypt {
|
|
|
|
@Test
|
|
public void testBCrypt() {
|
|
String hash = BCrypt.hashpw("mypasswordhere", BCrypt.gensalt());
|
|
assert BCrypt.checkpw("mypasswordhere", hash);
|
|
}
|
|
|
|
@Test
|
|
public void testRSA() {
|
|
assert "Hello World".equals(RSAUtil.decrypt(RSAUtil.encrypt("Hello World")));
|
|
assert "Encrypt".equals(RSAUtil.decrypt(RSAUtil.encrypt("Encrypt")));
|
|
}
|
|
|
|
}
|