Fast File Encryption

Well-designed File Encryption Solution for Medium and Large Files

Language Python
License Apache License 2.0
The Fast File Encryption library is an open-source, streamlined file encryption tool, optimal for encrypting medium to large files, including those up to terabyte size. It utilizes asymmetric RSA keys for encryption and decryption, allowing secure storage of the public key on a server. This design ensures ease of use while maintaining robust security for file encryption.


The library utilizes asymmetric RSA keys for encryption and decryption. Yet, it also provides handy methods to easily create new key pairs.

Encrypting data uses the public key. You can either encrypt a file and write it encrypted to a different location, directly encrypt byte data or use data streams for the encryption. In the simplest case, this all is done with a single call.

Decrypting data requires the matching private key of the public key which was used to encrypt the data. You can load and decrypt a file into a bytes object, copy the decrypted data into a new file or decrypt data from a data stream into another. Again, there are methods that do all of this with a single call.

In the library, the validity of the keys and the integrity of the files is thoughtfully checked, and an operation will only succeed if everything is ok.

The File Format

The file format is block oriented, similar like common image formats (e.g. PNG). It uses a magic header, and blocks with a four byte identifier and 64bit size field. Blocks can have a static size, or use a “chunked format” where the size is determined by following a sequence of smaller “data-chunks”.

This modular framework would allow to randomly add and mix different blocks and types, yet this format is very strict. Not only the number of blocks is defined, also the exact sequence of block is fixed and must not be changed. Using a strict format is speeding up verification and processing of the data. Also, it reduced risks of attacks using manipulated files.

Ready to Start?

Using the Fast File Encryption is straightforward. Please have a look at the Quick Start Section in the documentation. It shows how simple you can encrypt and decrypt files of any size.

Sources and License

Find all the sources of Fast File Encryption on GitHub. We’ve licensed the project under the Apache License, Version 2.0. This means you’re free to use this library not just in open-source projects, but also in proprietary software.