安卓手機(jī)字符密碼加密方式有哪些?
加密是類似下面的方法,鹽值是在/data/data/com.android.providers.settings/databases/settings.db數(shù)據(jù)庫secure的表里面,你文件里面看到的就是sha1+md5: (40位+32位)的值
public byte[] passwordToHash(String password)
{
if (password == null)
{
return null;
}
String algo = null;
byte[] hashed = null;
try
{
byte[] saltedPassword = (password + getSalt()).getBytes();
byte[] sha1 = MessageDigest.getInstance(algo = "SHA-1").digest(saltedPassword);
byte[] md5 = MessageDigest.getInstance(algo = "MD5").digest(saltedPassword);
hashed = (toHex(sha1) + toHex(md5)).getBytes();
}
catch (NoSuchAlgorithmException e)
{
Log.w(TAG, "Failed to encode string because of missing algorithm: " + algo);
}
return hashed;
}
簡(jiǎn)單來說就是sha1+MD5加鹽,這種加密方法目前無法破解