An in-depth analysis of the Android phone defender to save the password MD5 encryption _android

Source: Internet
Author: User
Tags md5 md5 encryption stringbuffer

Recommended reading:

A brief analysis of Android phone defender custom control properties

An analysis of Android phone defender turn off automatic Updates

Detailed Android Phone Guardian Settings Wizard page

The general mobile phone does not have root permissions, into the Data/data directory, when the phone brush machine, with root permissions, you can enter the Data/data directory, view our saved password file, so we need to save the password for MD5 encryption

Gets the MessageDigest information Digest object, calling Messagedigest.getinstance ("MD5"), Parameters: Rules

Invokes the digest (bytes) method of the MessageDigest object, gets the encrypted byte[] array, parameters: byte[] Array, and invokes the GetBytes () method of the string object to get to the byte array

With each byte go and 111,111,118 bits do with the operation and get the int type: Byte & 11111111

In the for (byte b:xxxxx) loop

Run byte & 0xff to get int value

Call Integer.tohexstring (number), get 16 and return string type

To judge the length of a string to be 1, stitch it in front of the 0

Loop outside defines a StringBuffer object that invokes the StringBuffer object's append () concatenation of strings

Call the StringBuffer object's ToString () method to get the standard string result after encryption

MD5 can be cracked, including MD5 (MD5 (MD5)) in this form, encrypt all the possibilities into the database, and then compare it to your MD5 password, you can md5 add salt

The software needs to uninstall and then test and erase the previously saved SP files

Package com.qingguow.mobilesafe.utils;
Import Java.security.MessageDigest;
public class Md5util {
/**
* Get MD5 encrypted string
* @param pass
* @return/Public
static string Md5password (String pass) {
messagedigest messagedigest;
try {
messagedigest = messagedigest.getinstance ("MD5");
Byte[] Bytes=messagedigest.digest (Pass.getbytes ());
StringBuffer sb=new StringBuffer ();
for (byte b:bytes) {
int number=b & 0xff;
String str=integer.tohexstring (number);
if (Str.length () ==1) {
sb.append ("0");
}
Sb.append (str);
return sb.tostring ();
} catch (Exception e) {
e.printstacktrace ();
}
Return "";
}
}

The above content is small to introduce the Android mobile phone defender to save the password when the MD5 encryption of the relevant knowledge, hope to help everyone!

Related Article

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.