buddy-core
buddy-core copied to clipboard
Feature Request - Support :hmac-sha1
I tried running the following but it appears there is no method implementation for :hmac-sha1. Will this be added?
(mac/hash payload {:key my-secret :alg :hmac+sha1})
I get an exception:
No method in multimethod 'engine' for dispatch value: :hmac+sha1
And I see that the method does not exist in the source.
Quickest way to achieve this is to add new dispatch to multimethod, like this:
(defmethod mac/engine :hmac+sha1
[options]
(let [digest (hash/resolve-digest-engine
(:digest options :sha1))]
(assert digest "Invalid digest engine.")
(org.bouncycastle.crypto.macs.HMac. digest)))
It can be done outside of library in your own code, so you don't need to wait for new release :)
PR is welcome ;)
Sure, #59
Wow, thanks for the quick responses and the PR!