paragonie / pecl-libsodium-doc

Free Online Documentation for the Libsodium PHP Extension

Home Page:https://paragonie.com/book/pecl-libsodium

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

5/8 byte output lenght

MikeRow opened this issue · comments

Hello, I need an ouput of 5 or 8 byte to generate a crypto work or validate an account

$state = sodium_crypto_generichash_init(null, 5);
$state = sodium_crypto_generichash_init(null, 8);

But I can't set less than 16. Any way to solve this?

You can output 16 bytes and truncate to 5 bytes if this is really what you need.

Ok, I'll try, to keep the output correct, should I truncate from begin or end? Apply any reverse?

Whatever. All bits have the same properties.