Android微信数据库密码生成规则

规则

加密规则, IMEI 拼接 uin , 然后取 MD5 信息摘要 (32位小写), 最后截取前七位.

其中 IMEI 可以在拨号键盘输入 *#06# , uin 存在 sp中, 路径为\data\data\com.tencent.mm\shared_prefs\auth_info_key_prefs.xml 中,如图所示:

auth_info_key_prefs

⚠️ Android 10 微信没有权限获取 IMEI , IMEI1234567890ABCDEF

代码

getMessageDigest((IMEI + uin).getBytes()).substring(0, 7)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

public static final String getMessageDigest(byte[] bArr) {
char[] cArr = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
try {
MessageDigest instance = MessageDigest.getInstance("MD5");
instance.update(bArr);
byte[] digest = instance.digest();
int length = digest.length;
char[] cArr2 = new char[length * 2];
int i2 = 0;
int i3 = 0;
while (i2 < length) {
byte b2 = digest[i2];
int i4 = i3 + 1;
cArr2[i3] = cArr[(b2 >>> 4) & 15];
cArr2[i4] = cArr[b2 & 15];
i2++;
i3 = i4 + 1;
}
return new String(cArr2);
} catch (Exception e2) {
return null;
}
}
作者

sadhu

发布于

2021-12-25

更新于

2021-12-25

许可协议