def gen_pwd(usr): generated = "" foo = ord(usr[1]) // 3 for i in range(len(usr)): foo = (ord(usr[i]) ^ foo) & 0x3c generated += (chr(foo + 0x30)) foo *= 3 return generated #program header *1337* print(""" _ ^-) (.._ \`\\\\ |> /| flamingo `""") print("--------------------------------------------------") print() usr = input("Input a 7-character username: ") while(len(usr) != 7): usr = input("PLEASE input a 7-character username: ") usr = usr + '\n' + chr(0) print("Generated Password:", gen_pwd(usr))