Lunaris

encryption and decryption solution built for newbies to understand how it works.

System Overview

What is Lunaris?

A professional custom encryption system using character substitution with special symbols ./_-+=!~. Features optional master key encryption, salt-based security, and Unicode support.

Character Mapping

Each character maps to unique 2-symbol combinations using 8 special characters.

Master Key Support

Optional PBKDF2 key derivation with XOR encryption layer.

Unicode Support

Handles any Unicode character with hex encoding fallback.

Salt-Based Security

Cryptographically secure random salts prevent rainbow attacks.

Encryption Process

Character Mapping Examples

Character Type Example Mapping
Lowercase a, b, c 'a': './'
Uppercase A, B, C 'A': '-!'
Numbers 0, 1, 2 '0': '~-'
Special Space, punctuation ' ': '=='
Unicode Any other char '€': '[U20AC]'

API Reference

Lunaris Class

Initialization
cipher = Lunaris(master_key=None)
Main Methods
Method Parameters Returns
encrypt(plaintext) str: text to encrypt str: encrypted text
decrypt(ciphertext) str: text to decrypt str: original plaintext
get_cipher_info() None dict: system info

CipherManager Class

High-level interface with error handling.

manager = CipherManager(master_key=None) # Safe operations return (success: bool, result: str) success, encrypted = manager.encrypt_text("Hello World") success, decrypted = manager.decrypt_text(encrypted)

Usage Examples

Basic Usage

#!/usr/bin/env python3 from customCrypt import Lunaris # Initialize cipher cipher = Lunaris() # Encrypt message message = "Hello World!" encrypted = cipher.encrypt(message) print(f"Encrypted: {encrypted}") # Decrypt message decrypted = cipher.decrypt(encrypted) print(f"Decrypted: {decrypted}") # Verify assert message == decrypted print("Success!")

Enhanced Security with Master Key

#!/usr/bin/env python3 from customCrypt import Lunaris # Initialize with master key cipher = Lunaris("MySecureKey123!") # Encrypt sensitive data data = "Confidential information" encrypted = cipher.encrypt(data) print(f"Encrypted: {encrypted}") # Output includes salt: base64_salt:encrypted_data # Decrypt with same cipher decrypted = cipher.decrypt(encrypted) print(f"Decrypted: {decrypted}")

Unicode Support

#!/usr/bin/env python3 from customCrypt import Lunaris cipher = Lunaris() # Unicode characters text = "Hello δΈ–η•Œ! Price: €25.99 🌍" encrypted = cipher.encrypt(text) decrypted = cipher.decrypt(encrypted) print(f"Original: {text}") print(f"Encrypted: {encrypted}") print(f"Decrypted: {decrypted}") assert text == decrypted

Command Line Usage

# Run the program python3 customCrypt.py # Interactive menu: # 1. Choose master key (optional) # 2. Select operation: # - Encrypt Text # - Decrypt Text # - Show System Info # - Exit

Error Handling with CipherManager

#!/usr/bin/env python3 from customCrypt import CipherManager manager = CipherManager() # Safe encryption with error handling success, result = manager.encrypt_text("Test message") if success: print(f"Encrypted: {result}") # Safe decryption success, decrypted = manager.decrypt_text(result) if success: print(f"Decrypted: {decrypted}") else: print(f"Decryption error: {decrypted}") else: print(f"Encryption error: {result}") # Get system info info = manager.get_info() for key, value in info.items(): print(f"{key}: {value}")