Closed basememara closed 6 years ago
I needed the base64 digest result of an HMAC encryption so I can generate JWT tokens (http://jwt.io), but Arcane was hard-coded to hex.
base64
HMAC
JWT
Arcane
hex
This PR exposes the option to choose hex or base64 digest for HMAC results:
HMAC.SHA256(string, key: key, digest: .hex) //Default HMAC.SHA256(string, key: key, digest: .base64)
See how other languages natively expose this option and some online encryption results that returns both digests.
With this new DigestType enum, maybe you can delete Base64 and use this API instead:
DigestType
Base64
Hash.SHA256(string, key: key, digest: .hex) //Default Hash.SHA256(string, key: key, digest: .base64)
I hope this helps and makes sense. Thanks for a great library! 👍
@basememara I totally accept this 👍 Thanks for the PR
@basememara Hi, I bumped the version for you https://github.com/onmyway133/Arcane/releases/tag/1.2.1
I needed the
base64
digest result of anHMAC
encryption so I can generateJWT
tokens (http://jwt.io), butArcane
was hard-coded tohex
.This PR exposes the option to choose
hex
orbase64
digest forHMAC
results:See how other languages natively expose this option and some online encryption results that returns both digests.
With this new
DigestType
enum, maybe you can deleteBase64
and use this API instead:I hope this helps and makes sense. Thanks for a great library! 👍