visit
Cryptography has been around long before modern computers and has been a great way to protect messages. When it comes to providing information while keeping it concealed from those who wish to use it for ill intentions, you need cryptography and codes to encrypt messages to keep them confidential. Back in the days of Rome and Julius Caesar, code was invented - a form of basic encryption and one of the earliest encryption algorithms in humanity’s recorded history - that would allow his messages of military significance to stay safe from prying eyes. This code was named after Julius himself and it was called the cipher.
"If he had anything confidential to say, he wrote it in cipher, that is, by so changing the order of the letters of the alphabet, that not a word could be made out. If anyone wishes to decipher these, and get at their meaning, he must substitute the fourth letter of the alphabet, namely D, for A, and so with the others." - Suetonius, Life of Julius Caesar 56
One of the great things about the Caesar cipher is how easy this form of encryption is to recreate with modern code. Even with basic Python, you can easily turn some text into a basic encrypted cipher using the following function:
def encrypt(text,s):
result = ""
for i in range(len(text)):
char = text[i]
# Encrypt the uppercase characters or lowercase letters as determined by an if statement
# before adding to the result variable
if (char.isupper()):
result += chr((ord(char) + s-65) % 26 + 65)
else:
result += chr((ord(char) + s - 97) % 26 + 97)
return result
This is something you can also easily program in Python:
def crack(message):
for i in range(len(LETTERS)):
translated = ''
for s in message:
if s in LETTERS:
num = LETTERS.find(symbol)
num = num - i
if num < 0:
num = num + len(LETTERS)
translated = translated + LETTERS[num]
else:
translated = translated + s
print('Potential Hacked Messages #%s: %s' % (i, translated))