On Wed, Feb 2, 2022 at 7:37 AM Scott Locklin <[email protected]> wrote:
> I wrote this a couple of years ago. It's a bit more bit fiddly, and I know
> it works as it was used in production to talk to an exchange.
>
> NB. hmac signature
> NB. x key, y needs signature
> NB. key may need to be made raw first
> 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
> )

Note that this implementation uses sha512 (which has a 128 byte block size).

Still, it's a good reference.

Thanks,

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

Reply via email to