RSA加密:
MD5加密:
1、MD5加密较为可靠,需要引入commons-codec-1.9.jar
2、MD5加密不可逆,也就是加密后不能再根据加密的秘钥去解密,网上MD5解密实际上是暴力破解。如果需要可逆的话,请选择DES、AES、异或、凯撒、RSA等。
3、MD5加密可以实现任何对象加密,这就决定了传入参数类型为byte数组,如果为int或者其他类型,就不能满足上述要求,任何对象都可以被转成byte数组,为了保持通用性而这样设计。
4、字符串到十六进制串
RSA加密:
1、SHA256较为可靠,需要引入commons-codec-1.9.jar
2、SHA256加密不可逆
3、SHA256加密可以实现任何对象加密,这就决定了传入参数类型为byte数组,如果为int或者其他类型,就不能满足上述要求,任何对象都可以被转成byte数组,为了保持通用性而这样设计
4、字符串到十六进制