DEV Community

skaunov
skaunov

Posted on

Cryptopals #30: Rust, solution approaches

There's few hashing challenges in Cryptopals, and some gave me pretty hard time. This one was solved pretty quickly, I even thought that I could cut too much along the way. Lack of solutions in Rust around got me to ask couple of peers to review the thing. So I received their "ok", and now have a minute to wrap up what I remember and how my approach was different.

As I wanted to learn more of real-world libs than do petty stuff I was trying to employ real encryption in this challenges as much as I can. This time I was seeking a way to recreate a Digest core in some intermediate state, but after some time concluded it's barely possible. Even when needed data appropriately structured there's no good way to deal with the system so that it would let me to run methods from the lib. Basically I'm talking about a structure with private fields and methods to construct it which are too sound and correct to help with the challenge.

So I chose to degrade the lib on purpose by only making respective core fields pub. I guess I would do it in a more clever way now, but at that time to move forward most straight-forward solution was to hover a whole supplementary repo to GitHub just for a couple of lines patch. You can find the final solution there.

I hope things changed since, but those days I couldn't find a clear Rust solution for this one. Though one of my peers added his own. Which I finally compared and report to you that we both handled the challenge with similar ideas!

Which one do you like better?

Top comments (0)