Created
February 10, 2021 17:12
-
-
Save GeraldHost/c260d1764263199d9bfac80874a9edf0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
from string import punctuation | |
from string import ascii_lowercase | |
from string import ascii_uppercase | |
from random import randint | |
import numpy as np | |
nums = '0123456789' | |
chars = ascii_lowercase + ascii_uppercase + nums | |
target = 52650 | |
strlen = 9 | |
def pswd(): | |
s = '' | |
for i in range(strlen): | |
s += chars[randint(0,len(chars)-1)] | |
return s | |
def check(s): | |
return sum([ord(c)*strlen*strlen for c in s]) == target | |
if __name__ == "__main__": | |
while True: | |
p = pswd() | |
print(p) | |
if check(p): | |
print(p) | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment