All Courses

Python Forensics - Cracking an Encryption

Neha Kumawat

3 years ago

Python Forensic
          In this chapter, we will learn about cracking a text data fetched during analysis and evidence.
A plain text in cryptography is some normal readable text, such as a message. A cipher text, on the other hand, is the output of an encryption algorithm fetched after you enter plain text.
Simple algorithm of how we turn a plain text message into a cipher text is the Caesar cipher, invented by Julius Caesar to keep the plain text secret from his enemies. This cipher involves shifting every letter in the message "forward" by three places in the alphabet.
Following is a demo illustration.
a → D
b → E
c → F
w → Z
x → A
y → B
z → C


           A message entered when you run a Python script gives all the possibilities of characters, which is used for pattern evidence.
The types of pattern evidences used are as follows −
  • Tire Tracks and Marks
  • Impressions
  • Fingerprints
  • Impressions
  • Fingerprints
  • Fingerprints
Every biometric data comprises of vector data, which we need to crack to gather full-proof evidence.
The following Python code shows how you can produce a cipher text from plain text −

import sys

def decrypt(k,cipher): 
   plaintext = '' 
   for each in cipher: 
      p = (ord(each)-k) % 126 
      if p < 32: 
         plaintext += chr(p) 
         print plaintext 

def main(argv):
   if (len(sys.argv) != 1): 
      cipher = raw_input('Enter message: ') 
      for i in range(1,95,1): 
if __name__ == "__main__": 


         Now, check the output of this code. When we enter a simple text "Radhika", the program will produce the following cipher text.
To know more about python programming click here and select option python.
Like the Blog, then Share it with your friends and colleagues to make this AI community stronger. 
To learn more about nuances of Artificial Intelligence, Python Programming, Deep Learning, Data Science and Machine Learning, visit our insideAIML blog page.
Keep Learning. Keep Growing. 

Submit Review