2023 Feb 16
Completed cryptopals set 3 challenge 20. Challenge 19 and 20 are breaking fixed-nonce CTR mode encryption, i.e. you are given a bunch of ciphertexts that were AES CTR mode encrypted using the same nonce. This means that the keystream that each plaintext was encrypted with is the same, meaning it’s similiar to repeated key XOR encryption, so we can break it the same way. Challenge 19 is doing this manually by guessing words and whatnot, but in challenge 20 we do it statistically by transposing the ciphertexts, and seeing what key byte would lead to the most common letters, then doing that for each byte in all ciphertexts at the same time to get the most likely key. Cool stuff. Excited to try the RNG crypto that’s up next.
Neovim approach
Use native commands when possible
Customize as much as I want for file exploration and things outside the main motions
Write some of my own plugins overtime to be in full control of my editor
Today’s work agenda
Try the changes
Learn all that I can about benchmarking
Hmm, thinking about versioning in Bitcoin consensus versus software. In something like a programming language, a “soft-fork” is backwards compatible in the sense that it added new functionality, but any code written in a previous version will still compile and run just fine. However in Bitcoin consensus, a soft-fork is backwards compatible in the sense that all valid transactions after the fork will be considered valid by nodes running previous software, but it’s interesting to note that some transactions that were previously valid will no longer be valid after the soft fork, i.e. consensus is constrained in a soft-fork. In consensus, a new “feature” is a new constraint, whereas in a programming language a new feature is an addition.
Cool blog post - measuring memory usage in rust (rust-analyzer blog). Talks about a couple of approaches: measuring usage by data structure (heap parsing), measuring calls to alloc/dealloc, etc. However parsing heap bytes at runtime is impossible in rust because there’s no garbage collector (don’t fully understand but it sorta makes sense). However you can apparently get the total allocated memory at runtime so they measure the displacement before and after a data structure is used (or something like that..).
git worktree - seems like it’s basically just branches are in different folders in a “bare” repository? This would’ve actually been pretty helpful today when I was trying to work on two branches at the same time as well as run benchmarks on each and it was annoying to switch back and forth and recompile everytime.
Learned today people call hashtag ‘#’ octothorp.
The real thing that’s compelling about NeoVim: the skill ceiling seems very high, and it seems like I could learn a lot along the way.
Learned a bunch of stuff that I probably can’t document all here. One cool thing was how neovim does autocomplete. There’s an autocomplete engine called
nvim-cmp
and you provide it with sources like your LSP or others which are separate plugins. In a vim git integration, you can even make requests to github’s API to be able to autocomplete the # PR/issue numbers while making a PR all from the command line.Also learned vim has some builtin autocomplete stuff with
already which is pretty crazy.
This is awesome: lightning.store
Forgot what it was called: opendime