Help me with this question in python:- | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Help me with this question in python:-

Make a program which accepts input from the user and hashes it with a particular hashing algorithm with atleast 6 character salt and returns the hashed value.

8th May 2019, 11:14 AM
anon
3 Answers
+ 2
import hashlib inp = str(input()).encode("utf-8") hashed = hashlib.sha256(inp).hexdigest() print(hashed) # You need to encode the string before hashing, otherwise it will return an error
8th May 2019, 6:41 PM
inxanedev!
inxanedev! - avatar
+ 2
Please show us your attempt.
8th May 2019, 11:32 AM
HonFu
HonFu - avatar
- 1
from hashlib import sha1 txt=bytes("Sololearn") hash=sha1(txt) print(hash) There are other algorithms in hashlib
8th May 2019, 12:43 PM
Dan Karnaukh