bcmyers / argonautica

Idiomatic argon2 password hashing for several languages
Apache License 2.0
146 stars 29 forks source link

Memory parameter has to be a power of 2 #10

Open fkorax opened 5 years ago

fkorax commented 5 years ago

Why does the parameter for configure_memory_size() have to be a power of 2? It doesn't have to be in other implementations, e.g. argon2 for Haskell.

nbraud commented 5 years ago

Good question; the Argon2 spec states “Memory size m can be any integer number of kilobytes from 8p to 2³²−1. The actual number of blocks is m′, which is m rounded down to the nearest multiple of 4p” (where p is the degree of parallelism).