Hi

2018-03-02 11:24 GMT-03:00 Esteban A. Maringolo <emaring...@gmail.com>:
> 2018-03-02 8:54 GMT-03:00 Ben Coman <b...@openinworld.com>:
>
>> On 2 March 2018 at 10:43, Esteban A. Maringolo <emaring...@gmail.com> wrote:
>
>>> So after all this what's the recommended way to use HMAC-SHA512 in Pharo
>>> 6?
>
>> Libsodium installation instructions...
>> https://github.com/Traadh/bittrex
>
> Why did you create  BittrexLibsodium library wrapper instead of a
> plain Libsodium wrapper like the one at
> http://smalltalkhub.com/#!/~tonyg/Crypto-Nacl/ ?
>
>

I inspected the Nacl library and it provides the functions:

crypto_auth_hmacsha256
crypto_auth_hmacsha256_bytes
crypto_auth_hmacsha256_keybytes
crypto_auth_hmacsha256_primitive
crypto_auth_hmacsha256_ref
crypto_auth_hmacsha256_ref_verify
crypto_auth_hmacsha256_verify
crypto_auth_hmacsha512256
crypto_auth_hmacsha512256_bytes
crypto_auth_hmacsha512256_keybytes
crypto_auth_hmacsha512256_primitive
crypto_auth_hmacsha512256_ref
crypto_auth_hmacsha512256_ref_verify
crypto_auth_hmacsha512256_verify

I've also followed the Ben's example in Nacl but the output is truncated

| data message output key expected |
data := 'Hi There' .
key := (ByteArray readHexFrom:
                '0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b',
                '0b0b0b0b') extendedToSize: 32.
expected := ByteArray readHexFrom:
                    '87aa7cdea5ef619d4ff0b4241a1d6cb0',
                    '2379f4e2ce4ec2787ad0b30545e17cde',
                    'daa833b7d6b8a702038b274eaea3f4e4',
                    'be9d914eeb61f1702e696c203a126854'.
output := ByteArray new: 64.
Nacl apiCryptoAuthHMAC512: output
        message: data
        messageLength: data size
        key: key.
output

Nacl class>>apiCryptoAuthHMAC512: c message: m messageLength: mlen key: key

    ^ self
        ffiCall: #(long crypto_auth_hmacsha512256(byte * c, byte * m,
ulonglong mlen, byte * key))
        module: 'libsodium'.

Ben do you know what could be happening here?


Hernán

Reply via email to