Hacker News new | ask | show | jobs
by dmitrygr 3040 days ago
A personal question. Do people really install megabytes of dependencies to run what would be a one line shell script, were it written in shell?
4 comments

A bigger issue is blindly executing "curl ... | sh -" for something you are going to use to generate passwords (though it's bad in general).
That is the official way that you install the Rust toolchain. https://www.rust-lang.org/en-US/install.html

Rust is still undergoing changes frequently enough that most package manager repos have a very old version of the Rust toolchain in terms of what it is capable of doing.

For example the version of rustc that you get from Ubuntu default repositories was too old to compile my pgen when I checked some weeks ago.

And exactly because the tool is for generating passwords I don't want to distribute pre-compiled binaries of my tool myself, and therefore until I get pgen itself into package manager repos I tell people to download the Rust toolchain and to build my tool from source themselves as I did above.

You wouldn't manage that with a one-line shell script, assuming that you want to format it reasonably. :)

I do agree that having to install loads of things for a simple tool is overkill, but I'd wager the actual binary produced doesn't have many dependencies (I'd expect just libc, in fact); so would this at some point land in a package manager, your life will improve.

Well...

    CHECKPW="p@ssword" SHA1=`echo -n "$CHECKPW" | sha1sum`; curl -s https://api.pwnedpasswords.com/range/${SHA1:0:5} | grep -i ${SHA1:5:34}
Note that this command doesn't work if your password contains an exclamation mark.
I wrote this as a replacement for what was previously a function in my .bashrc because of two things:

1) My shell function was too slow. There was a noticeable delay and it became annoying. The tool I wrote in Rust is insanely fast. Life improved!

2) The wordlist I used to use would use /usr/share/dict/words. These words are not good for typing because there are a lot of weird and arcane words in that list. The new tool I wrote has an optimized wordlist made by the EFF (read about it in the README) compiled right into it.

Regarding your question about installing other dependencies, like I said I will eventually get it into package managers. The pgen utility is a single binary. My assumption until then is that the people interested in my tool also happen to be interested in Rust and that therefore installing the Rust toolchain to use my tool will also give them motivation to get back into learning Rust like they at some point started doing. This was intentionally unstated but now you made me say it :)

Mental bandwidth is more expensive than megabytes, so yes.