4 ms·
or easier and shorter: printf PaSSw0rd | sha1sum
by ibotty 14y ago
or easier and shorter:
printf PaSSw0rd | sha1sum
- sjs 14y agoOr call shasum or sha1sum and input your password on stdin so your shell history doesn't contain your password in plain text.
- corin_ 14y agoJust pop a space at the beginning and it won't go into shell history.
- eridius 14y agoIt does for me > echo test test > history ... 6730 echo test 6731 history
- corin_ 14y agoSet this in your .bashrc HISTCONTROL=ignorespace Or even better, though unrelated to this topic... Also get it to ignore duplicates that come next to each other. HISTCONTROL=ignoredups:ignorespace
- tomku 14y agoThat's a bash-ism that's controlled by the $HISTCONTROL environment variable, not universally-applicable advice. $HISTCONTROL set to "ignorespace" or "ignoreboth" may or may not be the default, depending on your distribution.
- corin_ 14y agoYeah already replied below specifying that - I was under the impression that it's default to on in most distros, but don't actually have a clue which do/don't.
- ibotty 14y agoit will still be in ps output for a short while...
- ibotty 14y agohow do you get rid of the carriage return as last char that way?
- sltkr 14y agoWhat if my password contains % characters?
- eric_bullington 14y agoYeah, note that this doesn't work with all password combinations. I just use the Python version above python -c 'import hashlib; print hashlib.sha1("reALpassWORD12%12").hexdigest()' and then: history -d $((HISTCMD-2)) to delete the last entry in the bash history.