hur.st's bl.aagh

BSD, Ruby, Rust, Rambling

Password Generation in Ruby and Rust

Writing the same small program in two different languages.

[ruby] [rust]

I've been doing a fair bit of Rust lately. Honestly, I haven't been so smitten with a language since I started writing Ruby back in 1999.

Rust is many of the things Ruby isn't—precompiled, screaming fast, meticulously efficient, static, explicit, type-safe. But it's also expressive and, above all, fun. I think this rare mix makes it a good companion language for Ruby developers, particularly with things like Helix and rutie making it easy to bridge the two.

The best way of learning is by doing, so why not avoid that and just read about me doing something instead?

Continue Reading

mkpass

Command-line password generation

[rust]

mkpass is a simple command-line random password generator written in Rust, with built-in dictionaries to keep run-time dependencies to an absolute minimum.

Continue Reading

rtss

Relative Timestamps for Stuff

[rust]

rtss annotates its output with relative durations between consecutive lines and since program start.

Inspired by Kevin Burke's Golang tss, I thought it would be a fun exercise and a nice bit of Rust practice to implement something similar.

I'm fairly pleased with the result - it's considerably faster, running at hundreds of MB per second in my tests - and somewhat more featureful, including pty support, allowing it to work similarly to expect's unbuffer command.

Continue Reading

gcstool / ruby-gcs

Efficient set membership with Golomb Compressed Sets

[rust] [ruby]

Similar to Bloom Filters, Golomb Compressed sets allow for space-efficient probablistic storage of sets. In other words, you can ask a GCS if it's seen an object, and retrieve either "absolutely not" or "probably not" in response.

gcstool was my first Rust project, developed primarily to play about with the haveibeenpwned.com pwned-passwords-2.0.txt database. It can store all half a billion items with a false-positive rate of 1-in-50 million in just 1.6GB, importing them in just a few minutes, though with fairly high memory requirements.

Continue Reading