Get MD5 String from Message Digest

前端 未结 11 1175
伪装坚强ぢ
伪装坚强ぢ 2020-12-23 20:46

I understand how it works but if I want to print out the MD5 as String how would I do that?

public static void getMD5(String fileName) throws Exception{
            


        
11条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-23 21:14

    You can get it writing less:

    String hex = (new HexBinaryAdapter()).marshal(md5.digest(YOUR_STRING.getBytes()))
    

提交回复
热议问题