4 ms·
If you need a unique identifier on the command line there are a few ways to do it. uuidgen is one. My personal favorite is this snippet. $ id=$(openssl rand 1
by thinkingkong 6y ago
If you need a unique identifier on the command line there are a few ways to do it.
uuidgen is one. My personal favorite is this snippet.
$ id=$(openssl rand 1000 | openssl sha1) && printf "%s${id:0:8}\n"
- mormegil 6y agoWhy would you want to hash random bytes? The only thing you could theoretically achieve by that would be decreasing entropy. Just do openssl rand -hex 20 (or any other number of bytes as needed, or -base64 for another encoding).