1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

Compare commits

...

2 commits

Author SHA1 Message Date
catborise
bb31c09d25
Merge pull request #510 from catborise/master
update secret generator with new python secrets module - urlsafe
2022-06-28 11:22:12 +03:00
catborise
7bb5d6f313 update secret generator with new python secrets module - urlsafe 2022-06-28 11:13:23 +03:00

View file

@ -1,5 +1,13 @@
import random
import string
import secrets
haystack = string.ascii_letters + string.digits + string.punctuation
print(''.join([random.SystemRandom().choice(haystack.replace('/', '').replace('\'', '').replace('\"', '')) for _ in range(50)]))
generated_key = secrets.token_urlsafe(50)
print(''.join(generated_key))
### Use for old python versions < 3.6
##import random
##import string
#
##haystack = string.ascii_letters + string.digits + string.punctuation
##print(''.join([random.SystemRandom().choice(haystack.replace('/', '').replace('\'', '').replace('\"', '')) for _ in range(50)]))