Note: There is a more secure technique here that is more poorly written up.
I saw my pairing partner do this about six months ago and the elegance of it just struck me. Here’s the command line:
date +%s | sha256sum | base64 | head -c 8 ; echo
Let’s break that down:
date +%s 1567406528
The date + %s returns what I suspect is a unix epoch i.e. the number of seconds since a date in the 1970s.
The sha256sum takes that epoch and then returns something like this:
The base64 then takes that output and returns:
The head -c 8 then takes 8 characters out of this:
Note: The reason that the final output YzMyMGQ4 doesn’t appear in the base64 example is that I keep re-running this command pipeline and date %s keeps changing since it is tied to microseconds. And, yes, it took me a few moments to realize that. chuckle
Thank you Sean Kennedy for giving me another tool in the toolbox.