How can I decrypt a HMAC?

前端 未结 4 470
名媛妹妹
名媛妹妹 2020-12-29 09:29

I can make an HMAC using the following:

var encrypt = crypto.createHmac(\"SHA256\", secret).update(string).digest(\'base64\');

I am trying

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-29 09:56

    HMAC is a MAC/keyed hash, not a cipher. It's not designed to be decrypted. If you want to encrypt something, use a cipher, like AES, preferably in an authenticated mode like AES-GCM.

    The only way to "decrypt" is guessing the whole input and then comparing the output.

提交回复
热议问题