Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cryptography Organization

A comprehensive repository for cryptographic algorithms, protocols, and implementations. This project provides educational resources and practical examples of modern cryptographic techniques.

Table of Contents

Overview

This repository serves as a centralized hub for cryptography concepts, implementations, and best practices. It includes symmetric encryption, asymmetric encryption, hashing algorithms, key exchange protocols, and digital signatures.

Features

  • Symmetric Cryptography: AES, DES, ChaCha20
  • Asymmetric Cryptography: RSA, ECC, Diffie-Hellman
  • Hash Functions: SHA-256, SHA-512, BLAKE2
  • Digital Signatures: HMAC, DSA, ECDSA
  • Key Derivation: PBKDF2, Argon2, Scrypt
  • Educational Documentation: Detailed explanations and tutorials
  • Practical Examples: Real-world implementation patterns

Installation

Prerequisites

  • Python 3.8+ (or language-specific requirements)
  • pip/package manager
  • Git

Clone the Repository

git clone https://github.com/Ali-hey-0/Cryptography-organization.git
cd Cryptography-organization

Install Dependencies

pip install -r requirements.txt

Usage

Basic Example: Hashing

from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.backends import default_backend

message = b"Hello, Cryptography!"
digest = hashes.Hash(hashes.SHA256(), backend=default_backend())
digest.update(message)
hash_result = digest.finalize()
print(hash_result.hex())

Basic Example: Symmetric Encryption

from cryptography.fernet import Fernet

# Generate key
key = Fernet.generate_key()
cipher = Fernet(key)

# Encrypt
message = b"Secret message"
encrypted = cipher.encrypt(message)

# Decrypt
decrypted = cipher.decrypt(encrypted)
print(decrypted)

Basic Example: RSA Encryption

from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import serialization

# Generate keys
private_key = rsa.generate_private_key(public_exponent=65537, key_size=2048)
public_key = private_key.public_key()

# Encrypt with public key
ciphertext = public_key.encrypt(b"Secret", padding=padding.OAEP(...))

# Decrypt with private key
plaintext = private_key.decrypt(ciphertext, padding=padding.OAEP(...))

Project Structure

Cryptography-organization/
├── README.md
├── requirements.txt
├── symmetric/
│   ├── aes.py
│   ├── chacha20.py
│   └── des.py
├── asymmetric/
│   ├── rsa.py
│   ├── ecc.py
│   └── diffie_hellman.py
├── hashing/
│   ├── sha.py
│   ├── blake2.py
│   └── hmac.py
├── signatures/
│   ├── dsa.py
│   ├── ecdsa.py
│   └── rsa_sign.py
├── key_derivation/
│   ├── pbkdf2.py
│   ├── argon2.py
│   └── scrypt.py
└── examples/
    ├── secure_file_encryption.py
    ├── key_exchange.py
    └── digital_signatures.py

Cryptographic Concepts

Symmetric Cryptography

Symmetric algorithms use the same key for encryption and decryption. Fast and efficient for large data.

Asymmetric Cryptography

Asymmetric algorithms use public and private key pairs. Enable secure key exchange and digital signatures.

Hash Functions

One-way functions that produce fixed-size digests. Used for integrity verification and password storage.

Digital Signatures

Prove authenticity and non-repudiation using asymmetric cryptography.

Key Derivation

Functions to derive cryptographic keys from passwords or other sources securely.

Security Best Practices

  • ⚠️ Never hardcode secrets in source code
  • 🔐 Use established libraries like cryptography or PyCryptodome
  • 🔑 Implement proper key management with secure storage
  • 🛡️ Apply authenticated encryption (AES-GCM, ChaCha20-Poly1305)
  • 🚫 Avoid deprecated algorithms (DES, MD5, SHA-1)
  • 🔄 Use random nonces/IVs for each encryption operation
  • Validate all inputs before cryptographic operations

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/your-feature)
  3. Commit changes (git commit -m 'Add your feature')
  4. Push to branch (git push origin feature/your-feature)
  5. Open a Pull Request

Code Standards

  • Follow PEP 8 guidelines
  • Add docstrings to all functions
  • Include unit tests for new features
  • Update documentation as needed

Resources

License

This project is licensed under the MIT License - see the LICENSE file for details.

Disclaimer

This repository is for educational purposes. Do not use unreviewed cryptographic implementations in production systems. Always use peer-reviewed, well-tested libraries.

Contact

For questions or suggestions, please open an issue or contact the repository maintainers.


Last Updated: July 2026

About

No description, website, or topics provided.

Resources

Stars

18 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors