MD5 Encryption and DZ encryption

Source: Internet
Author: User
Tags md5 encryption

1.MD5 Encryption:

Java code
  1. Public static string Md64encode (String Password) {
  2. String newpassword = null;
  3. Try  {  
  4. MessageDigest MD5 = messagedigest.getinstance ("MD5");
  5. Base64encoder base64en = new base64encoder ();
  6. NewPassword = Base64en.encode (Md5.digest (Password.getbytes ()));
  7. System.out.println ("after encryption:"+newpassword);
  8. } catch (nosuchalgorithmexception e) {
  9. //TODO auto-generated catch block   
  10. E.printstacktrace ();
  11. }
  12. return  NewPassword;
  13. }

2.DZ Encryption method

Method: DZ Encryption is MD5 (MD5 (password) + timestamp);

Java code
  1. Public static string Dzencryption (String Password) {
  2. String newpassword = null;
  3. Try  {   
  4. MessageDigest MD5 = messagedigest.getinstance ("MD5");
  5. Base64encoder base64en = new base64encoder ();
  6. NewPassword = Base64en.encode (Md5.digest (Password.getbytes ()));
  7. NewPassword = Newpassword+system.currenttimemillis ();
  8. NewPassword = Base64en.encode (Md5.digest (Newpassword.getbytes ()));
  9. } catch (nosuchalgorithmexception e) {
  10. //TODO auto-generated catch block   
  11. E.printstacktrace ();
  12. }
  13. return  NewPassword;
  14. }

or call the MD5 method

Java code
    1. Md5util.md64encode (Md5util.md64encode ("666666") +system.currenttimemillis ())

Timestamp in 3.JAVA

System.currenttimemillis ();

MD5 Encryption and DZ encryption

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.