MCPcopy Create free account
hub / github.com/geekcomputers/Python / encrypt

Function encrypt

encryptsys.py:39–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37
38
39def encrypt():
40 texto = input("Input the text to encrypt : ")
41 abecedario = string.printable + "áéíóúÁÉÍÚÓàèìòùÀÈÌÒÙäëïöüÄËÏÖÜñÑ´"
42 abecedario2 = []
43 nummoves = randint(1, len(abecedario))
44 indexs = []
45
46 texttoenc = []
47
48 for l in range(0, len(abecedario)):
49 abecedario2.append(abecedario[l])
50
51 for let in range(0, len(texto)):
52 texttoenc.append(texto[let])
53
54 for letter in texto:
55 indexs.append(abecedario2.index(letter))
56
57 for move in range(0, nummoves):
58 abecedario2 += abecedario2.pop(0)
59
60 texto = []
61
62 for i in range(0, len(indexs)):
63 texto.append(abecedario2[indexs[i]])
64 texto.append(".")
65
66 fintext = ""
67
68 for letter2 in range(0, len(texto), 2):
69 fintext += texto[letter2]
70
71 fintext = str(nummoves) + "." + fintext
72
73 print(r"\Encrypted text : " + fintext)
74
75
76sel = input("What would you want to do?\n\n[1] Encrypt\n[2] Decrypt\n\n> ").lower()

Callers 1

encryptsys.pyFile · 0.70

Calls 3

appendMethod · 0.45
indexMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected