Compute SHA-1 of byte array

后端 未结 7 781
青春惊慌失措
青春惊慌失措 2020-11-29 23:02

I\'m looking for a way of getting an SHA-1 checksum with a Java byte array as the message.

Should I use a third party tool or is there something built in to the JVM

7条回答
  •  日久生厌
    2020-11-29 23:24

    You can do it yourself but I would recommend to use a library that has been proven to work, like Commons Codec. The class DigestUtils has several methods to calculate hashes.

提交回复
热议问题