Member-only story

šŸ“˜ Day 19 of #100DaysOfCode in Python: Cryptography

Elshad Karimov
2 min readDec 19, 2023

Security is paramount in our digital age. From ensuring that personal messages remain private to protecting financial transactions, cryptography is a crucial tool in the modern developerā€™s arsenal. Python, known for its expansive library ecosystem, provides robust tools for cryptography.

1. Introduction to Cryptography:

Cryptography is the practice and study of securing information. It involves transforming information in ways that make it unreadable without a special key, ensuring data integrity, authenticity, and confidentiality.

2. Hashing:

Hashing is the process of converting input (often called a message) into a fixed-length string of bytes. The output, typically a ā€œdigest,ā€ is unique to the given input.

Pythonā€™s hashlib Module: Python provides the hashlib module, which contains hashing algorithms like SHA256, MD5, and others.

Example:

import hashlib

data = "Hello, Python!"
hashed_data = hashlib.sha256(data.encode()).hexdigest()
print(hashed_data)

3. Encryption and Decryption:

Encryption is the process of converting plaintext into ciphertext using an algorithm and encryption key. Decryption is theā€¦

--

--

Elshad Karimov
Elshad Karimov

Written by Elshad Karimov

Software Engineer, Udemy Instructor and Book Author, Founder at AppMillers

No responses yet