Rust or Can’t understand the ‘use of moved value’ error

Uncategorized

I had allocated 2 hours to write out cryptopals in Rust. Instead it took about 4 hours. I am including the hour I spent on a coffee chat and general mingling.  It was a long four hours – it seemed like 1000 hours. I struggled with Options and unwrapping and &Str and String.  I rewrote code to fix a bug to discover I still had the same bug and uglier code. But in the end it worked and I finally pushed it to my github repo.  I have a back log of problems to implement,  I hope they go faster.

Do you see my title –  that error stopped me for about an hour while I rewrote all my chars to be Strings, only to figure out I needed to make a variable mutable. OY!

In any case, I made the program interactive which was very helpful in debugging since I could pass in parts of a hex string rather than the entire string.  I was aided in my work by these trusty websites and Austin and Liz.

After I had a quick rust code review with some folks where I picked up a bunch of tips like using Chunks, and using bitwise operations for optimization.   Last week I was really impressed with a presentation on assembly and we looked at this fantastic tool call godbolt that translates code into assembly.  You can also do this on the command line: RUSTFLAGS=”–emit asm” cargo build and the cat (in my case) target/debug/deps/cryptopals-*.s. I think it would be interesting to see how the compiler handles multiplication vs bitwise operations.

Some links that fellow rc’ers put up today that I want to investigate later are: A Sol Lewitt drawing application that implements his ‘algorithms’, a conference for women and non-binary coders, rust debugging (I am still looking for a good debugger to integrate with neovim), and Curv -“a programming language for creating art using mathematics.”

Tomorrow is the RC hackathon. I will probably be hacking with Tenor on devops tools for a computer herre. I am sort of obsessed with getting to use an expensive gpu for machine learning.  Tenor wants to build an env for k8 deployment (I’m oversimplifying).  If we dont get access to said computer we will probably hack on a super secret zulip integration.

One first today! It was also the first time that I remember using git rm -rf –cached ., because I forgot to gitignore my target files.

 

View at Medium.com