3

For example. When I calculate a hash with each functions I get different result.

PKI::PKI.digest("hola", "MD5")
digest::digest("hola", "md5")
kintero
  • 75
  • 3

1 Answers1

3

Use serialize = FALSE for digest.

> PKI::PKI.digest("hola", "MD5")
 [1] 4d 18 63 21 c1 a7 f0 f3 54 b2 97 e8 91 4a b2 40
> digest::digest("hola", "md5", serialize=FALSE)
[1] "4d186321c1a7f0f354b297e8914ab240"

The help page of digest states that the input is serialized by default.

mvkorpel
  • 526
  • 6
  • 10