Created
January 12, 2015 18:35
-
-
Save james-see/5edbf6238278ac01e3d1 to your computer and use it in GitHub Desktop.
pyde.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this script takes a 26 char string that you provide and | |
# a cipher and converts it back to text | |
# it works in pythonista | |
import random | |
import sys | |
import string | |
import console | |
import clipboard | |
import webbrowser | |
#functions | |
#this function gets inputs with custom prompts | |
def inputer(prompt): | |
value = None | |
while value is None: | |
try: | |
value = raw_input(prompt) | |
except ValueError: | |
print 'Please enter a tag' | |
value = None | |
return value | |
#get pinboard tag of interest | |
cipher = inputer("what is your string?: ") | |
phrased = inputer("What is your phrase?: ") | |
#GLOBALS | |
alphastring = cipher | |
alphalist = list(string.ascii_lowercase) | |
cipherstring = string.ascii_lowercase | |
example = phrased | |
if example == "": | |
example = "hello" | |
ouput = '' | |
i = 0 | |
convertnum = [] | |
encrypted = [] | |
for ch in example: | |
convertnum.append(str(alphastring.index(ch[i]))) | |
#print (convertnum) | |
print ''.join(cipherstring) | |
for cy in convertnum: | |
encrypted.append(cipherstring[int(cy)]) | |
#print cipherstring[int(cy)] | |
encrypted = ''.join(encrypted) | |
print encrypted | |
clipboard.set(encrypted) | |
webbrowser.open('workflow://') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment