51,410
社区成员
发帖
与我相关
我的任务
分享
import com.chilkatsoft.CkCrypt2;
public class EncryptUtil
{
static
{
try
{
String path = PlatConfig.getConfigFilePath();
System.load(path + "chilkat.dll");
} catch (UnsatisfiedLinkError e)
{
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
/**
* 加密方法
*
* @param mingwen
* @return
*/
public static String encrypt(String mingwen)
{
CkCrypt2 ck = new CkCrypt2();
ck.UnlockComponent("test");
ck.put_HashAlgorithm("md5");
ck.put_EncodingMode("base64");
ck.put_Charset("Unicode");
return ck.hashStringENC(mingwen);
}
public static void main(String[] args)
{
System.out.println(encrypt("123456"));
}
}