mrmeval

make secure passwords with bash

May 2nd, 2020
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #!/bin/bash
  2. LC_ALL=C tr -dc '[:alnum:]' < /dev/urandom | head -c ${1:-16}; echo;
  3. # might be better to use [:graph:] for some websites.
  4. # LC_ALL=C is the simplest local and overrides every LC setting. https://unix.stackexchange.com/questions/87745/what-does-lc-all-c-do
  5. # tr convertes the output of /dev/urandom the cryptographically strong random device to alnum which is all characters
  6. # and numbers. graph uses all printables except space
  7. # this is then truncated using head to 16 characters
  8. # Strangely enough this cuts off the infinite spew from urandom in the first half.
Add Comment
Please, Sign In to add comment