publicstaticfinalstringmd5(byte [ ] s ) {
final String MD5='MD5 ';
try {
//create MD5混列
. getinstance(MD5;
digest.update(s;
bytemessagedigest [ ]=digest.digest (;
//create hex字符串
byteamessagedigest :消息摘要(for ) {
stringh=integer.to hex string (0xffamessagedigest );
wile(h.Length ) (2) ) ) ) ) ) ) ) ) ) ) )。
h='0' h;
hexstring.append(h;
}
return hexString.toString (;
} catch (nosuchalgorithmexceptione ) )
e .打印堆栈跟踪(;
}
返回' ';
}
byte [ ]数据;
MD5 (数据);
在Android Studio 3.4.1上通过了测试。