signalapp / libsignal

Home to the Signal Protocol as well as other cryptographic primitives which make Signal possible.
GNU Affero General Public License v3.0
3.63k stars 420 forks source link

Update to string encoding for fingerprint #443

Closed GrishaVar closed 2 years ago

GrishaVar commented 2 years ago

I noticed there was a todo left in the comments :)

Should read5_mod_100k perhaps use u64::from_be_bytes? It would be more readable/understandable.

jrose-signal commented 2 years ago

Should read5_mod_100k perhaps use u64::from_be_bytes? It would be more readable/understandable.

I forgot to reply to this, but I think the widening from a 5-byte array to an 8-byte array would make the readability a wash. (Honestly even the TODO is sort of a wash on readability, but it does mean there's not hardcoded indexes.)

GrishaVar commented 2 years ago

Yep, I didn't add it because my conversion to [u8; 8] less readable than the current code.

jrose-signal commented 2 years ago

Thank you again!