Digital Forensics and Incident Response | DFIR
  • Blog
  • Infosec
  • Windows Forensics
  • Mac Forensics
  • Memory Forensics
  • Incident Response
  • Contact

Cryptography Ceasar Ciper and ROT 13 (Shift by 3 and 13)

4/11/2020

0 Comments

 
In this post, I am going to talk about the basic fundamental and concepts of Cryptography. Let's start with Obfuscation and Encryption. In layman's language, encryption techniques are used to hide data or make is difficult to read. The term 'Crypto' become super popular because of the introduction of the currencies like Bitcoin, Litecoin, Ethereum etc. For us, it's just a form of protection, our focus will be on the cryptography applied to the communication, storage, messages etc. We will be using Python for the code nuggets. Lets start with the 'Caesar Cipher' and 'ROT13'

Caesar Cipher: It's an old trick where you just move every letter forward three character in the alphabet.

Plain Text - abcdefghijklmnopqrstuvwxyz
Cipher Text - defghijklmnopqrstuvwxyzabc

For example:
hello = khoor

Lets implement this in python!


beta = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#GETTING User Input
user_input = raw_input("Enter a message in Capital Letters")
#Calculating String Length
n = len(user_input)
str_out = ""

for i in range(n):
        c = user_input[i]
        loc = beta.find(c)
        print i ,c,loc,
        newloc = loc +3
        str_out += beta[newloc]
        print newloc, str_out

print "Obfuscated Version:", str_out



Picture
ROT13 will do the shift by '13' instead of '3'
0 Comments



Leave a Reply.

    Categories

    All
    Chapter-1
    CISSP
    SOC
    Threat Detection
    Threat Hunting
    Threat Modelling

    RSS Feed