Welcome to Photocrypt’s documentation¶
Photocrypt¶
What is photocrypt?¶
Photocrypt is a python package provides tools to encrypt and decrypt various image formats.
Requirements¶
Photocrypt requires Python 3.6 version or newer.
Installation¶
You can install our pacakage with pip:
pip install photocrypt
This will install dependencies of photocrypt as well.
What’s inside¶
Photocrypt has five submodules including itself:
photocrypt: operations for image encryption
photocrypt.core: basic classes and operations used within photocrypt.
photocrypt.crypto: ciphers that work on bytes.
photocrypt.image: image classes and operations.
photocrypt.utils: useful classes and operations.
Quick Start¶
This page will show simple usages of our package.
Generate Keys¶
The code below shows how to generate keys:
from photocrypt.crypto.RSA import generate_key, save_keypair
# generate key pair
private_key, public_key = generate_key()
# save key pair
save_keypair((private_key, public_key), ("private.pem", "public.pem"))
Encrypt Image¶
The code below shows how to load public key and encrypt an image:
from photocrypt import open_image, encrypt_image
from photocrypt.crypto.RSA import load_key
# open image
image = open_image("samples/tuatara.jpg")
# load public key
public_key = load_key("public.pem")
# encrypt image
image_enc = encrypt_image(image, public_key)
# save image
image.save("samples/tuatara_enc.jpg")
Decrypt Image¶
The code below shows how to load private key and decrypt an image:
from photocrypt import open_image, decrypt_image
from photocrypt.crypto.RSA import load_key
# open image
image = open_image("samples/tuatara_enc.jpg")
# load private key
private_key = load_key("private.pem")
# encrypt image
image_enc = encrypt_image(image, private_key)
# save image
image.save("samples/tuatara_dec.jpg")
User documentation¶
photocrypt.core
¶
Introduction¶
The photocrypt.core
module
contains basic classes and operations used within photocrypt package.
photocrypt.core.image
¶
photocrypt.core.bdata
¶
photocrypt.core.bstream
¶
photocrypt.core.cipher
¶
photocrypt.core.packer
¶
photocrypt.crypto
¶
Introduction¶
The photocrypt.crypto
module
contains ciphers and operations related to cryptography.
photocrypt.crypto.AES
¶
photocrypt.crypto.RSA
¶
All operations in photocrypt package are organized in sub-modules; each sub-module includes specific class of functionalities.
Package |
Description |
---|---|
contains basic classes and operations used within photocrypt package. |
|
contains ciphers and operations related to cryptography. |
|
contains image classes that can be used by photocrypt operations. |
|
conatins useful tools |
License¶
MIT License
Copyright (c) 2020 Sean Kullmann and Hosung Lee
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.