DEV Community 👩‍💻👨‍💻


Posted on • Updated on

"str and String in Rust confuses a lot of people in the beginning"

That what Rusteans said to me, after couple of clumsy conversions between strings and buffers.

When I found some ambiguity in Cryptopals #25, I started to look around for different approaches people employed to tackle it.

Also, after considerable hesitation, I started to use Rust, being completely new to it. As Cryptopals put it in they own words: "Our friend Maciej says these challenges are a good way to learn a new language, so maybe now's the time to pick up Clojure or Rust." Why not?

I thought so, until I finally verified my understanding, that both kind of strings in Rust... must be UTF-8 compliant, and won't hold any gibberish. So, strictly speaking part of the challenges become impossible for us, ordinary mortals, when done following description. And part become significantly more difficult, narrowing the space for solutions. So, formally learning Rust with Cryptopals can bring you nightmare side-quests.

This thing with strings, I feel like I like it atm. It's a reasonable type to receive plaintexts, and Rust instantly makes attacks much harder to implement by limiting input with validation. And for exercises we use buffers, of course. Who don't!

Latest comments (0)

We are hiring! Do you want to be our Senior Platform Engineer? Are you capable of chipping in across sysadmin, ops, and site reliability work, while supporting the open source stack that runs DEV and other communities?

This role might just be for you!

Apply now