This verb might be useful to someone at some point. Pretty
straightforward stuff, but fiddley and no point in reinventing the wheel
if someone else needs it.

https://en.wikipedia.org/wiki/Hash-based_message_authentication_code


NB. hmac signature
NB. x key, y needs signature
hmac=: 4 : 0
 key=. x,(128 - #x) # 0{a.
 ixorkey =.  ((22 b.)&(16b36) a. i. key){a.
 raw=. _5 (128!:6) ixorkey,y
 oxorkey =. ((22 b.)&(16b5c) a. i. key){a.
 5 (128!:6) oxorkey,raw
)

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to