Skip to main content

FFenc - File Encryption Tool

A secure file encryption and decryption tool with password protection.

Features

  • Secure Encryption: Uses Fernet (AES-128-CBC) for content encryption
  • Password Protection: Encrypts the encryption key with PBKDF2 key derivation
  • CLI Interface: Easy-to-use command-line interface
  • Hidden Passwords: Secure password input that doesn't display on screen
  • File and Text Support: Encrypt both files and text content
  • Binary Safe: Handles both text and binary files

Installation

pip install -e .

Usage

Command Line Interface

The tool provides several commands for different use cases:

Encrypt a File

# Encrypt a file (password will be prompted)
ffenc encrypt-file input.txt output.enc

# Encrypt with password provided
ffenc encrypt-file input.txt output.enc --password "mysecret"

# Encrypt with password flag
ffenc encrypt-file input.txt output.enc -p "mysecret"

Decrypt a File

# Decrypt to a new file (password will be prompted)
ffenc decrypt-file output.enc decrypted.txt

# Decrypt to stdout
ffenc decrypt-file output.enc --stdout

# Decrypt with password provided
ffenc decrypt-file output.enc decrypted.txt -p "mysecret"

Encrypt Text Content

# Encrypt text from command line
ffenc encrypt-text "Hello, secret message!" output.enc

# Encrypt text from file
ffenc encrypt-text --file input.txt output.enc

# Encrypt text from stdin
echo "Secret message" | ffenc encrypt-text output.enc

Python API

You can also use the functions directly in Python:

from ffenc import encrypt, decrypt

# Encrypt content
encrypt("my_password", "Hello, secret message!", "output.enc")

# Decrypt content
decrypted = decrypt("my_password", "output.enc")
print(decrypted.decode('utf-8'))  # Hello, secret message!

Security Features

  • Key Generation: Each encryption generates a unique random key
  • Key Derivation: Uses PBKDF2 with 100,000 iterations for password-based key derivation
  • Salt: Each encryption uses a unique salt for additional security
  • Secure Storage: The encryption key is encrypted with the password before storage

File Format

Encrypted files are stored in JSON format containing:

  • Encrypted encryption key (encrypted with password)
  • Salt used for key derivation
  • Encrypted content (base64 encoded)

Examples

Encrypting a sensitive document

ffenc encrypt-file secret_document.txt secret_document.enc
# Enter password when prompted

Decrypting and viewing content

ffenc decrypt-file secret_document.enc --stdout
# Enter password when prompted

Encrypting a configuration file

ffenc encrypt-text --file config.json config.enc
# Enter password when prompted

Development

Running Tests

pytest tests/

Building

pip install build
python -m build

License

MIT License - see LICENSE.txt for details.

Metadata

Release files for ffenc 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ffenc 0.0.1
File Size Uploaded
ffenc-0.0.1.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ffenc 0.0.1
File Interpreter ABI Platform
ffenc-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.6 kB

Release files / ffenc-0.0.1.tar.gz

Download URL ffenc-0.0.1.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1938a997131f93c6260002d8b87bb830252f65abde6fde98174b0530feadac02
BLAKE2b-256 checksum
How to use checksums
86e0d8e11e6908722815e5a979d510d3eb026e69d85e5ca87c3a127ed4cbd4e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release files / ffenc-0.0.1-py3-none-any.whl

Download URL ffenc-0.0.1-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e22bff0bdbd5ec3e7ebb0b6006e86e22c8ff9b8cfbce8c7bfad92bb0390bfe8
BLAKE2b-256 checksum
How to use checksums
1a9bbfda730229f8621b5cff6514e94cfa6314ebefeb380529322094edf76797
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page