gpt4 book ai didi

java - md5 php和android不一样

转载 作者:行者123 更新时间:2023-11-29 06:06:38 24 4
gpt4 key购买 nike

<分区>

我正在计算一个文件的 md5 但得到不同的结果

代码:

 public void onCreate(Bundle savedInstanceState) { 
super.onCreate(savedInstanceState);
AssetManager am = getResources().getAssets();
String as = null;
try {
InputStream is=am.open("sdapk.db");
as=is.toString();
}catch(IOException e) {
Log.v("Error_E",""+e);
}
String res = md5(as);
TextView tv = new TextView(this);
tv.setText(res);
setContentView(tv);
}
public String md5(String s) {
try {
MessageDigest digest = java.security.MessageDigest.getInstance("MD5"); digest.update(s.getBytes()); byte messageDigest[] = digest.digest();

// Create Hex String
StringBuffer hexString = new StringBuffer();
for (int i=0; i<messageDigest.length; i++)
hexString.append(Integer.toHexString(0xFF & messageDigest[i]));
return hexString.toString();

} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return "";
}

}

php md5 : E959637E4E88FDEC377F0A15A109BB9A

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com