public class Demo {/** * @param args * @throws NoSuchAlgorithmException  */public static void main(String[] args) throws NoSuchAlgorithmException {MessageDigest digest = MessageDigest.getInstance("md5");String password = "123456";byte [] bytes =  digest.digest(password.getBytes());StringBuffer buffer = new StringBuffer();for(byte b: bytes){int number = b & 0xff;//加盐String hex = Integer.toHexString(number);if(hex.length()==1){buffer.append("0");}buffer.append(hex);}//md5加密后的值System.out.println(buffer);}}

版权声明:本文为博主原创文章,未经博主允许不得转载。

更多相关文章

  1. android开机启动代码
  2. Android(安卓)点击按钮,文本文字改变
  3. android studio
  4. Notes on the implementation of encryption in Android(安卓)3.
  5. AES加密解密Android版
  6. 如何在android画分析图(例如 柱状图、趋势图、饼图)
  7. android、ios与服务器端php使用rsa加密解密通讯
  8. Android(安卓)AES加密算法及事实上现
  9. Android入门第十六篇之Style与Theme

随机推荐

  1. android中使用线程池和临时缓存优化网络
  2. android 中 Error:Could not find suppor
  3. [Android]获取未安装的APK图标
  4. Android 系统 目录 分析
  5. Android使用selector自定义按钮
  6. Android手机端加载电脑端网页
  7. Android系统的Binder机制之一——Service
  8. Fix bug in the notepad tutorial of And
  9. Android下引用系统库的方法及问题
  10. [日更-2019.4.22、23、24] cm-14.1 Andro