Remix.run Logo
weare138 a day ago

If anyone is that desperate for a secure random password here's a Perl one-liner I came up with that will generate random cryptographically secure passwords with all unique characters using /dev/urandom. No dependencies:

  perl -E 'while (open($_,"/dev/urandom") && $#p+1 != $ARGV[0]) { $_ = getc $_, push @p, grep !$u{$_}++, /[!-~]/g } say @p' 24

Minified:

  perl -E 'while(open($_,"/dev/urandom")&&$#p+1!=$ARGV[0]){$_=getc$_;push@p,/[!-~]/g}say@p' 42