libtom / libtomcrypt

LibTomCrypt is a fairly comprehensive, modular and portable cryptographic toolkit that provides developers with a vast array of well known published block ciphers, one-way hash functions, chaining modes, pseudo-random number generators, public key cryptography and a plethora of other routines.
https://www.libtom.net
Other
1.51k stars 449 forks source link

Format of r in poly1305? #617

Open donaastor opened 1 year ago

donaastor commented 1 year ago

I would like to know how is $r$ from Poly1305 represented in the poly1305_state structure? It is stored in 5 uint32's: r[0], r[1], r[2], r[3], r[4], but what is the format? Is it a little-endian in some base? Perhaps in the base of 0x3ffffff? Does it mean that r[0] is the value of r mod 0x3ffffff?

The main reason for this is to be able to check if $r$ is too small in which case I want to choose another one.