How can I create an SHA512 digest string in Java using bouncy castle?

前端 未结 4 1869
梦谈多话
梦谈多话 2020-12-24 08:52

This unit test is failing:

    public void testDigest() throws NoSuchAlgorithmException {
    String hashExpected = \"150a14ed5bea6cc731cf86c41566ac427a8db48         


        
4条回答
  •  轮回少年
    2020-12-24 09:46

    Yes, you need to turn your byte array into a hex string. :-) Look into Apache Commons Codec, especially the Hex class.

提交回复
热议问题