def encrypt(): text = request.form['text'] rot = int(request.form['rot']) mess = '' for letter in text: letter = rotate_character(letter,rot) mess += letter return form.format(mess)
def encrypt(): rot = request.form["rot"] text = request.form["text"] sentence = '' for char in text: new_val = rotate_character(char, rot) sentence = sentence + new_val return form.format(sentence)
def encrypt(): rot = int(request.form['rot']) text = request.form['text'] encrypted_string = '' for char in text: encrypted_string = encrypted_string + rotate_character(char, rot) return form.format(encrypted_string)
def encrypt(text, word): n_encrypt = '' n_list = [] z = 0 for char in range(len(text)): for l in word: n_list.append(l) for char in text: keyletter = n_list[z] keyvalue = alphabet_position(keyletter) if char.isalpha() == True: x = rotate_character(char, keyvalue) n_encrypt += str(x) z += 1 else: v = rotate_character(char, keyvalue) n_encrypt += str(v) return n_encrypt
def encrypt(): text = request.form['text'] rot = int(request.form['rot']) new_str = "" for i in range(len(text)): if text[i].isalpha(): new_str = new_str + rotate_character(text[i], rot) else: new_str = new_str + text[i] return header + body.format(new_str) + footer
def Vigenere(text, key): newMessage = "" k = [] z = 0 count = 0 for i in range(len(text)): for j in key: k.append(j) for jj in text: zz = k[z] y = alphabet_position(zz) if jj != " " and jj != "," and jj != "?" and jj != "." and jj != "!": x = rotate_character(jj, y) newMessage += x z += 1 elif jj == " " or jj == "." or jj == "!" or jj == "," or jj == "?": x = rotate_character(jj, y) newMessage += x return newMessage
def encrypt(text, key): i = 0 key_mod = len(key) ciphertext = '' for char in text: if char.isalpha(): ciphertext += rotate_character(char, alphabet_position(key[i])) i = (i + 1) % key_mod else: ciphertext += char return ciphertext
def encrypt(): # Get the values from the two form inputs rotate = request.form['rot'] text = request.form['text'] newString = '' # Rotate character for char in text: newString += rotate_character(char, int(rotate)) return form.format(newString)
def encrypt(): message = '' rotate_by = request.form['rot'] text = request.form['text'] for char in text: if char.isalpha(): message += rotate_character(char, rotate_by) else: message += char return form.format(m=message)
def decrypt(ciphertext, key): i = 0 key_mod = len(key) original = '' for char in ciphertext: if char.isalpha(): original_shift = alphabet_position(key[i]) original += rotate_character(char, -original_shift) i = (i + 1) % key_mod else: original += char return original
def encrypt(): new_text = "" text = request.form["text"] rot = request.form["rot"] for i in text: if i.isalpha(): x = rotate_character(i, int(rot)) new_text += x else: new_text += i return form.format(new_text)
def encrypt(): rot = request.form ['rot'] rot = int(rot) text = request.form ['text'] text = str(text) encrypted = "" for each_char in text: if each_char == '': encrypted = encrypted + '' else: each_char = rotate_character(each_char,rot) encrypted = encrypted + str(each_char) return '<h1>'+form.format(encrypted)+'</h1>'
def encrypt(): message = '' try: rotate_by = int(request.form['rot']) except: #rotate_by = 0 return "Rotate was not an integer." text = request.form['text'] for char in text: if char.isalpha(): message += rotate_character(char, rotate_by) else: message += char return form.format(message)
def encrypt(): rotate = int(request.form['rot']) maintext = request.form['text'] returnrotation = rotate_character(maintext, rotate) return '<h1>' + returnrotation + '</h1>'