Skip to content

code-razz/Honey-Encryption

Repository files navigation

Honey Encryption

A Python implementation of Honey Encryption with AI-powered decoy generation and secure communication capabilities.

🍯 What is Honey Encryption?

Honey Encryption is a security technique that provides plausible deniability by generating multiple decoy messages that appear equally valid when decrypted with incorrect keys. This makes it extremely difficult for attackers to determine which message is the real one, even if they gain access to the encrypted data.

✨ Features

  • Advanced Encryption: Uses AES-256 encryption with PBKDF2 key derivation
  • AI-Powered Decoys: Generates realistic decoy messages using Google's Gemini AI
  • Plausible Deniability: Multiple decoy messages make it impossible to distinguish the real message
  • GUI Interface: User-friendly Tkinter-based application for encryption/decryption
  • Network Communication: Secure TCP-based chat application with encrypted messaging
  • File Transfer: Encrypted file sharing capabilities
  • Cross-Platform: Works on Windows, macOS, and Linux

🏗️ Architecture

Core Components

  1. HE_algo.py - Core Honey Encryption algorithm implementation
  2. gen_ai_single.py - AI-powered decoy message generation using Gemini API
  3. index.py - GUI application for standalone encryption/decryption
  4. HE_index.py - Programmatic interface for encryption/decryption
  5. TCP_server.py - Multi-client chat server with file sharing
  6. TCP_client.py - Chat client with encrypted messaging

Security Features

  • PBKDF2 Key Derivation: 100,000 iterations with SHA-256
  • AES-256 Encryption: CFB mode with random IV
  • Random Salt Generation: 16-byte salt for each encryption
  • AI-Generated Decoys: Realistic sentences that match original message length
  • Base64 Encoding: Safe transmission of binary data

🚀 Installation

Prerequisites

  • Python 3.7 or higher
  • Internet connection (for AI decoy generation)

Setup

  1. Clone the repository

    git clone https://github.com/code-razz/Honey-Encryption
    cd Honey-Encryption
  2. Install dependencies

    pip install cryptography python-dotenv google-generativeai
  3. Configure AI API (for decoy generation)

    • Create a .env file in the project root
    • Add your Gemini API key:
      GEMINI_API_KEY=your_api_key_here
      
    • Get your API key from Google AI Studio

📖 Usage

1. Standalone Encryption/Decryption

Run the GUI application:

python index.py

Features:

  • Enter your password/key
  • Input text for encryption or paste ciphertext for decryption
  • View encrypted data or decrypted messages
  • All decoy messages are displayed when decrypting

2. Programmatic Usage

from HE_index import encrypt_message, decrypt_message

# Encrypt a message
password = "your_secret_password"
message = "This is a secret message"
encrypted_data = encrypt_message(password, message)

# Decrypt the message
decrypted_messages = decrypt_message(password, str(encrypted_data))
real_message = decrypted_messages[0]  # First message is the real one

3. Network Chat Application

Start the server:

python TCP_server.py

Start a client:

python TCP_client.py

Features:

  • Real-time encrypted messaging
  • File sharing with encryption
  • Multi-client support
  • Automatic message decryption

🔧 Configuration

Server Configuration

Edit TCP_server.py to change server settings:

server = Server(host='0.0.0.0', port=5000)

Client Configuration

Edit TCP_client.py to connect to your server:

client = Client(host='192.168.31.77', port=5000)

Encryption Password

Change the default password in TCP_client.py:

HE_password = "your_custom_password"

🧪 Testing

Run the test file to verify functionality:

python test.py

📁 Project Structure

Honey-Encryption-main/
├── HE_algo.py          # Core encryption algorithm
├── gen_ai_single.py    # AI decoy generation
├── index.py           # GUI application
├── HE_index.py        # Programmatic interface
├── TCP_server.py      # Chat server
├── TCP_client.py      # Chat client
├── test.py           # Test file
├── README.md         # This file
└── not_used/         # Unused/experimental files
    ├── conn.py
    ├── index copy.py
    └── TCP_socket.py

🆘 Troubleshooting

Common Issues

  1. API Key Error: Ensure your .env file contains the correct Gemini API key
  2. Connection Refused: Check if the server is running and the IP/port is correct
  3. Import Errors: Make sure all dependencies are installed
  4. Decryption Failures: Verify the password matches the one used for encryption

Built with ❤️ using Python, Cryptography, and Google Gemini AI by Raj Sah (https://github.com/code-razz)

About

A Python implementation of Honey Encryption with AI-powered decoy generation and secure communication capabilities.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages