@recursive TIL const fn
Conversation
Notices
-
Embed this notice
Ryan Castellucci :nonbinary_flag: (ryanc@infosec.exchange)'s status on Sunday, 08-Sep-2024 03:30:05 JST Ryan Castellucci :nonbinary_flag: -
Embed this notice
Alexandra Magin 🏳️🌈 (recursive@hachyderm.io)'s status on Sunday, 08-Sep-2024 03:30:06 JST Alexandra Magin 🏳️🌈 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>
-
Embed this notice
Alexandra Magin 🏳️🌈 (recursive@hachyderm.io)'s status on Sunday, 08-Sep-2024 03:30:06 JST Alexandra Magin 🏳️🌈 and yes that means that very soon I will have to implement AES-128-ECB
In conversation permalink -
Embed this notice
Alexandra Magin 🏳️🌈 (recursive@hachyderm.io)'s status on Sunday, 08-Sep-2024 03:30:07 JST Alexandra Magin 🏳️🌈 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)
In conversation permalink
-
Embed this notice