Convert MD5 array to String java

后端 未结 5 1007
一个人的身影
一个人的身影 2020-12-16 00:29

I know that there is a lot of similar topics, but still... can someone provide me a working example of method which generates MD5 String.
I\'m currently using MessageDig

5条回答
  •  清酒与你
    2020-12-16 01:15

    MessageDigest md = MessageDigest.getInstance("MD5");
    byte[] arr = md.digest(bytesOfMessage);
    return Base64.getEncoder().encodeToString(arr);
    

    note: md5 is not considered as good hash algorithm anymore, consider choosing SHAs

提交回复
热议问题