[foogallery id=”1024″]

How to create Hash calculator Using Python

#Author: ManishHacker1

How to create Hash calculator Using Python

Hello guys, Today we will learn, how to create hash calculator using python with the help from hashlib module using Python.In my previous article, we was learnt about cryptographic hashes. Now we will be make a hash calculator.


Python Installed in your Operating System.


In my code, first import

  • import hashlib
  • import sys
  • import optparse

where hashlib module for hashing algorithm
sys module use for system fuction
and last one, optparse module use for command line options.

Full Source Code of How to create Hash calculator Using Python

import hashlib
import sys
import optparse

parser = optparse.OptionParser()
parser.add_option('-n', '--name', dest='name', help='''Your Algo Name Options:
parser.add_option('-k', '--key', dest='key', help='Your string key value')

(options, args) = parser.parse_args()

list = ['md5','sha1','sha224','sha384','sha512']

if options.name is None:
    options.name = raw_input('Please enter right Algo Name: ')
    if options.name in list:
        print 'Ok'
        print 'You are choose wrong Algo Name'
if options.key is None:
    options.key = raw_input('Enter Your Key Value: ')

select = options.name 
data = options.key 

h = hashlib.new(select)
print 'Your ' + select + ' hash value: ',h.hexdigest()

In above code save as “anyname.py” where “.py” our file extension.

When you run above program, Your Encode.txt Decode your origanal content and save as same location as Decode.txt.

How to Use:


Open your command prompt and change your directory path where our hash_calculator.py is store.

After that, type in your command prompt:

python hash_calculator.py -h

Usage: Python hash_calculator1.py [options]

  -h, --help            show this help message and exit
  -n NAME, --name=NAME  Your Algo Name Options:
  -k KEY, --key=KEY     Your string key value

Or you can direct use of this program. Write below command in your command prompt :

 python hash_calculator.py       and hit enter

After that enter your right algo name for example md5.

After that write your string value which you want to convert in md5 algorithm.

Thank You for reading this article.
And like my FB page givin below link and share it.

Best Python, PHP and Ethical Hacking Training in Meerut, Noida , Delhi.
Visit our official website: Kryptora | Planet of Technology

  • Ethical Hacking Training in Meerut
  • Python Training in Meerut
  • Python Training in Noida
  • Best Python Training in India
  • Best Hacking Training in Noida
  • Black Hat Hacking Training in Meerut
  • Black Hat Hacking Training in Noida
  • Artificial Intelligence Training in Meerut
  • Machine Learning Training in Meerut
  • Data Analysis Training in Meerut
  • PHP Training in Meerut
  • PHP Training in Noida
  • Data Analysis Training in Noida

Official Website: Kryptora | Planet of Technology

Follow ManishHacker1