Wemall-mobile is based on the Wemall Android App Store, only need to upload the interface file in the original mall directory to complete the server configuration, the client can be customized modification. This article shares the main code of the Android Development MD5 encryption tool class for technician reference learning.
Package Com.gzcivil.utils;import Java.io.unsupportedencodingexception;import Java.security.messagedigest;import Java.security.nosuchalgorithmexception;public class Md5tool {public static string MD5 (String string) {byte[] H Ash try {hash = messagedigest.getinstance ("MD5"). Digest (String.getbytes ("UTF-8")); } catch (NoSuchAlgorithmException e) {throw new RuntimeException ("Huh, MD5 should be supported?", e); } catch (Unsupportedencodingexception e) {throw new RuntimeException ("Huh, UTF-8 should be supported?", e); } StringBuilder hex = new StringBuilder (Hash.length * 2); for (byte B:hash) {if ((b & 0xFF) < 0x10) Hex.append ("0"); Hex.append (integer.tohexstring (b & 0xFF)); } return hex.tostring (); public static string encrypt (string data) {if (data = = NULL) data = ""; byte[] Btret = null; try { Btret = _encrypt (Data.getbytes ("Utf-8")); } catch (Unsupportedencodingexception e) {e.printstacktrace (); } if (Btret = = null) return null; Return Binstr.byte2str (Btret). toLowerCase (); }/** * Encrypt MD5 * * @param content * requires encrypted contents * @param password * Encrypt password * @return */private static byte[] _encrypt (byte[] btdata) {try {//MD5 object to get MessageDigest digest algorithm MessageDigest mdinst = messagedigest.getinstance ("MD5"); Updates the digest mdinst.update (btdata) using the specified byte; Get ciphertext return mdinst.digest (); } catch (Exception e) {e.printstacktrace (); return null; } } }
Original Details Address: http://git.oschina.net/einsqing/wemall-mobile
Wemall-mobile Mall details Address: http://www.koahub.com/home/product/56
Wemall website Address: http://www.wemallshop.com
Wemall-Open Source Micro-Mall Mall Mall Source Distribution Mall B2B2C Mall system
Wemall App Store source Android Development MD5 Encryption Tool class