An overview to Cryptography
uCryptography is a method of protecting information and
communications through the use of codes so that only those for whom the
information is intended can read and process it
uA we can convert some data into encrypted format using
various hashing
algorithms
uMD5
uSHA1
uSHA256
uSHA512
uEvery such algorithm takes some data and produce a
fixed length output called as cipher
Example using Python
import hashlib
data=input("Enter
data to encrypt ")
a=hashlib.md5(data.encode()).hexdigest()
b=hashlib.sha1(data.encode()).hexdigest()
c=hashlib.sha256(data.encode()).hexdigest()
d=hashlib.sha512(data.encode()).hexdigest()
print(a,len(a))
print(b,len(b))
print(c,len(c))
print(d,len(d))
Output
Enter data to
encrypt 1234
81dc9bdb52d04dc20036dbd8313ed055
length 32
7110eda4d09e062aa5e4a390b0a572ac0d2c0220
length 40
03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4
length 64
d404559f602eab6fd602ac7680dacbfaadd13630335e951f097af3900e9de176b6db28512f2e000b9d04fba5133e8b1c6e8df59db3a8ab9d60be4b97cc9e81db
length 128
Comments
Post a Comment