DEV Community

skaunov
skaunov

Posted on • Edited 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!

Quadratic AI

Quadratic AI – The Spreadsheet with AI, Code, and Connections

  • AI-Powered Insights: Ask questions in plain English and get instant visualizations
  • Multi-Language Support: Seamlessly switch between Python, SQL, and JavaScript in one workspace
  • Zero Setup Required: Connect to databases or drag-and-drop files straight from your browser
  • Live Collaboration: Work together in real-time, no matter where your team is located
  • Beyond Formulas: Tackle complex analysis that traditional spreadsheets can't handle

Get started for free.

Watch The Demo 📊✨

Top comments (0)

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay