Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I posted some advice in a sibling thread, <https://news.ycombinator.com/item?id=31021503>, that applies here as well:

> Please don't use $RANDOM or $((RANDOM)) or standard `shuf` for password generation. These RNGs are not cryptographically secure. Use input from /dev/urandom instead.



You can do this with "shuf --random-source=/dev/urandom".

The same with gshuf.

I use an alias to add this switch by default.


When using shuf for cryptographic purposes, I'd first check if it advertises as being able to be a secure cryptographic token generator when provided with a secure random source. It might very well use modulo operations, for example.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: