How to reproduce an SHA256-based HMAC from R in Python 3
问题 I am trying to reproduce salted sha256 output from R code in Python: library(openssl) res = sha256("test@gmail.com", key = "111") res # [1] "172f052058445afd9fe3afce05bfec573b5bb4c659bfd4cfc69a59d1597a0031" import hashlib, binascii dk = hashlib.pbkdf2_hmac(='sha256', b'test@gmail.com', b'111', 0) binascii.hexlify(dk) # b'494c86307ffb9e9e31c4ec8782af6498e91272c011a316c242d9164d765be257' How can I make output in python match R? 回答1: I can't quite reproduce your issue. The following keys match