pyshg.py - URL safe password/hash generator

Started by Pallas_Boreas, 2026-Jun-30, 18:59:54

Previous topic - Next topic

Pallas_Boreas

The Python Secure Hash Generator (pyshg) , a small CLI Python 3 URL safe hash generator. It uses the secrets module so that the hash generated is from the hardware RNG making it more secure then software hash generators. I use it for my passwords and anytime I want a hash that can be used almost everywhere.

The maximum amounts of characters is 10, 240 which is 1024*10. I did ten generations of 1024 characters each, deleting the generation variable once it has been added to the pool. This is not necessary until one runs into embedded systems with very tight constraints on RAM.

Every run is a new seed that in a way resets the generation. If I did one big run of 10,240 characters it would less random. By splitting it into ten runs that is ten seeds and ten generations making the pool more random while also being easier on embedded systems.

I have used it for over a year on various distros of Linux (shells: bash + fish), Android, and the Linux container on ChromeOS flawlessly and it is pretty damn fast. If run in a script the number of characters to pick from the pool is supplied as an argument in standard unix format as so for a 32 character password/hash:
pysgh.py 32
If run in the shell interactively you will be prompted for the amount of characters you want picked from the pool.

It uses the Unlicense license which can be found on this site here: https://polar-sun.xyz/index.php?msg=14. A good read is the Unlicense webstie itself at https://unlicense.org. In short, the program is in the Public Domain. As free as free can be.
You can support Polar Sun Research at https://ko-fi.com/psr.