Git Product home page Git Product logo

aeif-lib's Introduction

AEIF (AES Encrypted Image File) Library

The AEIF (AES Encrypted Image File) library is a Python library that provides functionality for encrypting and decrypting image files using the AES encryption algorithm.

Installation

You can install the AEIF library using pip:

pip install aeif-lib

Usage

Generating a key

To generate a key, you can use the genkey function:

from aeif_lib import genkey

# Generate a random key with the specified size
# (only 16, 24, and 32 bytes is supported) and save it to a file
key_path, key = genkey("path/to/save/key")

Encrypting an image

To encrypt an image, you can use the encrypt function:

from aeif_lib import AEIFManager, genkey, verify_hash

key_path, _ = genkey("path/to/save/key", 32)

# Create an AEIFManager object
# (key_path is optional but will be required for encryption/decryption if not set)
aeif = AEIFManager(key_path)

# Encrypt the image (key or key_path is optional if the key is already set)
aeif.encrypt("./img.png", "./img_e.aeif")

Decrypting an image

To decrypt an image, you can use the decrypt function:

from aeif_lib import AEIFManager

key_path = "path/to/the/key"

# Create an AEIFManager object
# (key_path is optional but will be required for encryption/decryption if not set)
aeif = AEIFManager(key_path)

# Decrypt the image (key or key_path is optional if the key is already set)
aeif.decrypt("./img_e.aeif", "./img_d.png")

# Verify the hash of the original image and the decrypted image
verify = verify_hash(("./img.png", "./img_d.png"))
print("Hashes match!" if verify else "Hashes do not match!")

aeif-lib's People

Contributors

pekgame avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.