Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sha-256 hashing in python

I wanted to create a python program thats asks for an input then hashes(sha-256) the input then prints it. Does this already exist? How would I go about doing so.

like image 790
User9123 Avatar asked Feb 04 '18 21:02

User9123


People also ask

Is Hashlib built in Python?

The Python hashlib module is an interface for hashing messages easily. This contains numerous methods which will handle hashing any raw message in an encrypted format. The core purpose of this module is to use a hash function on a string, and encrypt it so that it is very difficult to decrypt it.

What is SHA-256 hash used for?

SHA-256 is used in some of the most popular authentication and encryption protocols, including SSL, TLS, IPsec, SSH, and PGP. In Unix and Linux, SHA-256 is used for secure password hashing. Cryptocurrencies such as Bitcoin use SHA-256 for verifying transactions.


1 Answers

using hashlib:

from hashlib import sha256

input_ = input('Enter something: ')
print(sha256(input_.encode('utf-8')).hexdigest())
like image 197
zamir Avatar answered Nov 02 '22 12:11

zamir