Doing Cryptopals in Rust with a commitment to use nothing except the standard library is definitely making me a better Rust programmer
-
Doing Cryptopals in Rust with a commitment to use nothing except the standard library is definitely making me a better Rust programmer
I just finished doing base64 decoding (with padding and whitespace handling a la PEM, MIME, etc) and it may not be the prettiest code, but I'm pretty confident in its correctness. I want to never use a less strongly typed language ever again (I'll probably be forced to on Monday)
-
Alexandra Magin 🏳️🌈replied to Alexandra Magin 🏳️🌈 last edited by
I love that I can populate a const array using a const fn:
https://github.com/jamagin/cryptopals/blob/b7e79c0eb8faa9ae2bf1f0f5af2a462fa35459aa/src/bytes.rs#L21
and have the values in the array be Ok(value) for valid inputs and Err(Base64ParseError) for the restI think with some more experience I could write something even clearer for the rest of the implementation, but this feels like a good start:
https://github.com/jamagin/cryptopals/blob/b7e79c0eb8faa9ae2bf1f0f5af2a462fa35459aa/src/bytes.rs#L57Still trying to feel out what's the most sensible thing for arguments and return values in an API, &[u8] vs Vec<u8>
-
Alexandra Magin 🏳️🌈replied to Alexandra Magin 🏳️🌈 last edited by
and yes that means that very soon I will have to implement AES-128-ECB
-
Ryan Castellucci :nonbinary_flag:replied to Alexandra Magin 🏳️🌈 last edited by
@recursive TIL const fn