Jump to content

BenProgrammer

Member
  • Posts

    3
  • Joined

  • Last visited

Awards

This user doesn't have any awards

BenProgrammer's Achievements

  1. Caesar Cipher encryption program:) 62 lines! Encrypt, decrypt and brute force! Made in Python. MaxKeySize = 26 #defines max key, sets the value of MaxKeySize to 25 print ("Welcome to the Caesar Cipher Converter made by the amazing Ben Johnson!.")#welcome messagedef getMode(): while True:#function to get the mode that the user wants to use print('Encrypt, decrypt or brute force?' "Valid inputs are: encrypt, decrypt, brute, e, d, b") mode = input().lower() #converts the mode to lower case before validating if mode in 'encrypt e decrypt d brute b'.split(): #validation return mode #returns mode else: print('Enter either "encrypt" or "e" or "decrypt" or "d" or "brute" or "b".') #will only be printed if user enters an invalid input def getMessage(): #function to get message print('Enter your message:')#print return input()#returns the users message to the function def getKey(): #function to get the offset key key = 0 while True: #while loop for validation print('Enter the key number (1-%s)' % (MaxKeySize)) key = int(input()) if (key >= 1 and key <= MaxKeySize): return key def getTranslatedMessage(mode, message, key): #function to get the encrypted message if mode[0] == 'd': #decrypt key = -key #-key from ascii equivalent translated = '' for symbol in message: # if symbol.isalpha():# num = ord(symbol)# num += key# this code is to encrypt the message, as it converts each symbol to ascii using ord() command and then adds the key if symbol.isupper(): if num > ord('Z'): num -= 26 elif num < ord('A'): num += 26 elif symbol.islower(): if num > ord('z'): num -= 26 elif num < ord('a'): num += 26 #this code and above is to make sure there are no mistakes, as it stops errors with a's and z's etc translated += chr(num) else: translated += symbol return translated mode = getMode()message = getMessage()if mode[0] != 'b': #brute force key = getKey() print('Your translated text is:')if mode[0] != 'b': print(getTranslatedMessage(mode, message, key))else: for key in range(1, MaxKeySize + 1): #for loop to use brute force to decrypt print(key, getTranslatedMessage('decrypt', message, key))
  2. Hi:) I'm looking to build a new PC for around £400 GBP. I already have a copy of Windows 7, Mouse, Keyboard, and Monitor. The computer will be used for: - Office documents - Gaming - Minecraft - Garry's Mod - CS:GO - Tekkit/FTB I'd also like to be able to upgrade it in the future to run such games as GTA V. In the future I may also upgrade to 3 x 1080p monitors. I've heard about the Pentium G3258 Dual Core as it is a beast for overclocking, however i'm not sure.
×