Reputation: 788
I have hashes generated in Python this way:
In [2]: from hashlib import md5
...: md5(b"some text").hexdigest()
Out[2]: '552e21cd4cd9918678e3c1a0df491bc3'
However, in R, the result is different:
require(digest)
hash = digest("some text", algo="md5")
print(hash)
"bfd22782dabc6d7af9a9af962cc60752"
Upvotes: 2
Views: 154
Reputation: 788
R handles many types of data when hashing. We have to explicitly tell it to not serialize the string:
require(digest)
hash = digest("some text", algo="md5", serialize = FALSE)
print(hash)
"552e21cd4cd9918678e3c1a0df491bc3"
Upvotes: 2