Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def program():
- def validation(inp):
- split = inp.split(" ")
- if len(split)==2 and (split[0].lower()=="enc" or split[0].lower()=="dec"):
- return True, split[0].lower(), split[1]
- else:
- return False, "",""
- encryption_syntax = [
- ['a','∞'],
- ['A','8'],
- ['b','`'],
- ['B','{'],
- ['c','/'],
- ['C','('],
- ['d','+'],
- ['D',')'],
- ['e','c'],
- ['E','3'],
- ['f','?'],
- ['F','#'],
- ['g','}'],
- ['G','$'],
- ['h','O'],
- ['H',';'],
- ['i','-'],
- ['I','|'],
- ['j','B'],
- ['J','['],
- ['k','z'],
- ['K','@'],
- ['l','.'],
- ['L','1'],
- ['m','5'],
- ['M','='],
- ['n','<'],
- ['N','A'],
- ['O','0'],
- ['o','*'],
- ['p','%'],
- ['P',']'],
- ['q','Y'],
- ['Q','F'],
- ['r','>'],
- ['R','\\'],#double slash cause its an escape char
- ['s','~'],
- ['S','^'],
- ['t','M'],
- ['T','f'],
- ['u','!'],
- ['U',','],
- ['v','"'],
- ['V','p'],
- ['w','v'],
- ['W','V'],
- ['x',':'],
- ['X',';'],
- ['y','7'],
- ['Y','a'],
- ['z','j'],
- ['Z','9'],
- ['3','i'],
- ['9','&']
- ]
- inp=input()
- passed, keyword, password = validation(inp)
- if passed:
- def convert(num,num2):
- new_password=""
- i = 0
- for char in password:
- for char_set in encryption_syntax:
- if char==char_set[num]:
- new_password+=char_set[num2]
- break;
- i+=1
- return new_password
- if keyword == "enc":
- print(convert(0,1))
- if keyword == "dec":
- print(convert(1,0))
- else:
- print("Invalid Input")
- program()
- program()
Advertisement
Comments
-
- Why though? This is crazy unsafe and if someone got the result of passing in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' they've just leaked your entire encryption table and reversing it is trivial.
- Always hash passwords with a known secure algorithm like argon2.
Add Comment
Please, Sign In to add comment
Advertisement