nacl4s icon indicating copy to clipboard operation
nacl4s copied to clipboard

_easy interfaces

Open jedisct1 opened this issue 9 years ago • 3 comments

nacl4s is a fantastic project, thank you so much for working on this! A pure Scala (hence pure Java bytecode) implementation is definitely going to be very useful.

Just a request: could you possibly add the _easy API to crypto_box and crypto_secretbox?

From a user perspective, the original API with the extra padding is painful to use, error-prone and doesn't make sense in a language without pointer arithmetic. None of the bindings for non-C languages require padding and the kung-fu it then requires to remove it.

jedisct1 avatar Jun 19 '15 17:06 jedisct1

@jedisct1 I believe it would help if you described such an API.

afiskon avatar Jun 20 '15 12:06 afiskon

Hi Afiskon,

http://doc.libsodium.org/secret-key_cryptography/authenticated_encryption.html

crypto_secretbox_easy() puts the authenticator followed by the ciphertext into the target buffer, crypto_secretbox_open_easy() is the reverse operation.

http://doc.libsodium.org/public-key_cryptography/authenticated_encryption.html

crypto_box_easy(), crypto_box_open_easy(), crypto_box_easy_afternm() are the counterparts for public-key encryption.

jedisct1 avatar Jun 20 '15 15:06 jedisct1

@jedisct1 thank you for your interest, I will add it in new version

emstlk avatar Jun 20 '15 16:06 emstlk