Skip to content

Instantly share code, notes, and snippets.

@GeraldHost
Created February 10, 2021 17:12
Show Gist options
  • Save GeraldHost/c260d1764263199d9bfac80874a9edf0 to your computer and use it in GitHub Desktop.
Save GeraldHost/c260d1764263199d9bfac80874a9edf0 to your computer and use it in GitHub Desktop.
#! /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