|
|
@ -21,6 +21,8 @@ def rot(inputString, amount):
|
|
|
|
|
|
|
|
|
|
|
|
def translate(inputString, inputType, outputType):
|
|
|
|
def translate(inputString, inputType, outputType):
|
|
|
|
result = ""
|
|
|
|
result = ""
|
|
|
|
|
|
|
|
if(inputType == outputType):
|
|
|
|
|
|
|
|
result = inputString
|
|
|
|
if (inputType == 5):
|
|
|
|
if (inputType == 5):
|
|
|
|
for char in inputString:
|
|
|
|
for char in inputString:
|
|
|
|
if(outputType == 1):
|
|
|
|
if(outputType == 1):
|
|
|
@ -34,25 +36,24 @@ def translate(inputString, inputType, outputType):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
result = inputString
|
|
|
|
result = inputString
|
|
|
|
elif (inputType == 1): #binary
|
|
|
|
elif (inputType == 1): #binary
|
|
|
|
if(outputType == 1):
|
|
|
|
inputString = int(inputString, 2)
|
|
|
|
|
|
|
|
if(outputType == 2):
|
|
|
|
result = inputString
|
|
|
|
result = inputString
|
|
|
|
elif(outputType == 2):
|
|
|
|
|
|
|
|
result = int(inputString, 2)
|
|
|
|
|
|
|
|
elif(outputType == 3):
|
|
|
|
elif(outputType == 3):
|
|
|
|
result = oct(int(inputString, 2))
|
|
|
|
result = oct(inputString)
|
|
|
|
elif(outputType == 4):
|
|
|
|
elif(outputType == 4):
|
|
|
|
result = hex(int(inputString, 2))
|
|
|
|
result = hex(inputString)
|
|
|
|
elif(outputType == 5):
|
|
|
|
elif(outputType == 5):
|
|
|
|
result = char(int(inputString, 2))
|
|
|
|
result = chr(inputString)
|
|
|
|
elif (inputType == 2):
|
|
|
|
elif (inputType == 2):
|
|
|
|
if(outputType == 1):
|
|
|
|
if(outputType == 1):
|
|
|
|
result = bin(inputString)
|
|
|
|
result = bin(inputString)
|
|
|
|
elif(outputType == 2):
|
|
|
|
elif(outputType == 2):
|
|
|
|
result = inputString
|
|
|
|
result = inputString
|
|
|
|
elif(outputType == 3):
|
|
|
|
elif(outputType == 3):
|
|
|
|
result = oct(inputString)
|
|
|
|
result = oct(int(inputString))
|
|
|
|
elif(outputType == 4):
|
|
|
|
elif(outputType == 4):
|
|
|
|
result = hex(inputString)
|
|
|
|
result = hex(int(inputString))
|
|
|
|
elif(outputType == 5):
|
|
|
|
elif(outputType == 5):
|
|
|
|
result = chr(int(inputString))
|
|
|
|
result = chr(int(inputString))
|
|
|
|
elif (inputType == 3):
|
|
|
|
elif (inputType == 3):
|
|
|
@ -77,6 +78,19 @@ def translate(inputString, inputType, outputType):
|
|
|
|
result = inputString;
|
|
|
|
result = inputString;
|
|
|
|
elif(outputType == 5):
|
|
|
|
elif(outputType == 5):
|
|
|
|
result = chr(int(inputString,16))
|
|
|
|
result = chr(int(inputString,16))
|
|
|
|
|
|
|
|
elif (inputType == 5):
|
|
|
|
|
|
|
|
if(outputType == 1):
|
|
|
|
|
|
|
|
result = bin(ord(inputString))
|
|
|
|
|
|
|
|
elif(outputType == 2):
|
|
|
|
|
|
|
|
result = ord(inputString)
|
|
|
|
|
|
|
|
elif(outputType == 3):
|
|
|
|
|
|
|
|
result = oct(ord(inputString))
|
|
|
|
|
|
|
|
elif(outputType == 4):
|
|
|
|
|
|
|
|
result = hex(ord(inputString))
|
|
|
|
|
|
|
|
elif(outputType == 5):
|
|
|
|
|
|
|
|
result = inputString
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print result
|
|
|
|
print result
|
|
|
|
|
|
|
|
|
|
|
@ -98,11 +112,13 @@ def translatePrompt():
|
|
|
|
inputType = input("Please specify input type: ")
|
|
|
|
inputType = input("Please specify input type: ")
|
|
|
|
outputType = input("Please specify output type: ")
|
|
|
|
outputType = input("Please specify output type: ")
|
|
|
|
if (inputType == 5):
|
|
|
|
if (inputType == 5):
|
|
|
|
inputString = raw_input("Please input your string: ")
|
|
|
|
inputString = raw_input("Please input your strings, seperated by semicolon: ")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
inputString = raw_input("Please input your value: ")
|
|
|
|
inputString = raw_input("Please input your values, seperated by semicolon: ")
|
|
|
|
|
|
|
|
|
|
|
|
translate(inputString, inputType, outputType)
|
|
|
|
inputList = inputString.split(";")
|
|
|
|
|
|
|
|
for entry in inputList:
|
|
|
|
|
|
|
|
translate(entry, inputType, outputType)
|
|
|
|
|
|
|
|
|
|
|
|
def hashPrompt():
|
|
|
|
def hashPrompt():
|
|
|
|
typeChoice = raw_input('Would you like to hash a file or a String? f for file, s for string: ')
|
|
|
|
typeChoice = raw_input('Would you like to hash a file or a String? f for file, s for string: ')
|
|
|
|