2023 Feb 17
Idea for building a server + CLI tool with Rust: Providing educational certificates with cryptography -> applied to cryptopals!
Summary
A server that will test your cryptopals solutions and gives you digitally signed certifications for each set you complete.
A CLI tool that makes it easy to submit to the server.
All code is open source. Can run the server locally and add flag
--local
to CLI to do everything for free.
Usage flow
- Run initialize command - create and save key pair to disk, send signed join message, pay invoice, receive signature
Implementation notes
Pay 100 sats for 250 requests (should give you room to do the whole thing) for DoS protection
Identify a person by in the CLI tool allowing them to have a key pair and to make digital signatures (use PGP?) - need a good way for them to publish certification and have people verify the cert’s pubkey is actually them (use some sort of publically associated key - PGP, nostr?)
Verification and certification part of server can be completely stateless. Start with this. Then can build on top for a way to store previous challenge completions and certifications. Use sqlite for lightweight database. Sike, do need to store how many requests someone has made.
For certain challenges, it’s not just a decrypted message that can be submitted, but test cases that need to be run to prove proper completion. Maybe you will want to standardize the whole process and have them provide a command to run that will print to stdout, and so the server can send a set of random test cases and the cli tool will locally run and send the solutions.
Could use LDK for learning experience, or could just something like C-lightning because it’s an out of the box solution and it’s just running on a server.
Extra features
Allow option to input an email as backup in case they uninstall or lose identification
Different pricing - 50 sats for 50 requests
Did some work with measuring memory usage of the change I’ve been exploring.
There are many different numbers your computer can give you regarding memory, but probably the simplest and most representative of a process’s usage is just the total memory usage given by top or activity monitor (MacOS).
- Many people online talk about using ps with rss and vsz fields, but these seem pretty inaccurate, i.e. rss (resident set size) is all the memory used to load a process’s pages but doesn’t account for shared libraries, and vsz (virtual memory size) is how much memory is allocated for the process, which is more of a maximum memory usage but not actual usage.
Learned about the different grep’s. grep is basic regex searching, egrep is grep with metacharacters for regex such as “+*()?” etc., fgrep is no fast/fixed string grep with no regex, pgrep returns process IDs where the name/filepath matches the pattern.
Actually used git worktree to compile test executables for my different branches all at once and it was nice. I was switching between them and had to recompile everytime, and rust compilation for tests is so slow because it
cargo test
will create the same test executable, and only then run that executable with your specified string for select tests. So basically it compiles all test code even if you are only doing one test. I wonder why this hasn’t been solved in rust yet because this would literally 10x every developer’s iteration speed (if they’re working in a remotely large/well-tested codebase).
A mersenne prime is a prime that is one less than a power of two.