A tool that can easily encrypt and decrypt. Utilizes the symmetric key cryptography method (AES).
Project description
※下の方に日本語の説明があります。
ezenc: A Simple AES Encryption Library
Easily handle AES encryption without complexity.
Overview
ezenc is a Python library designed to simplify AES encryption. While AES encryption can be intricate and difficult to manage, ezenc offers a lightweight and intuitive API for encrypting and decrypting data effortlessly.
Key Features
- Easy AES Encryption: No need to handle complex encryption steps.
- Flexible Key Length: Any key length can be used. Internally, it is automatically converted to 256 bits via a hash function.
- Lightweight and Minimal: Focuses on simplicity and ease of use.
Installation
To install ezenc, simply add it to your project:
pip install ezenc
Usage
import ezenc
# Encryption
encrypted_data = ezenc.enc(b"hello!", b"test-key")
print(encrypted_data)
# Decryption
decrypted_data = ezenc.dec(encrypted_data, b"test-key")
print(decrypted_data) # Output: b'hello!'
How It Works
- The provided key is internally processed to a 256-bit value using a hash function.
- The encryption function (
enc) converts plaintext into an AES-encrypted byte sequence. - The decryption function (
dec) restores the original data using the same key.
Important Notes
- The key must be consistent for both encryption and decryption. If a different key is used, decryption will fail.
- The library ensures a fixed 256-bit key internally, so users don't have to worry about key length.
License
This project is open-source. Feel free to use and modify it.
ezenc: 簡単なAES暗号化ライブラリ
複雑なAES暗号をシンプルに
概要
ezenc は、AES暗号化を簡単に扱うためのPythonライブラリです。AES暗号は通常、扱いが難しく煩雑になりがちですが、ezenc を使えばシンプルなAPIで簡単にデータを暗号化・復号できます。
特徴
- 簡単なAES暗号化:複雑な処理なしで暗号化可能。
- 自由なキー長:キーの長さは自由で、内部でハッシュ関数を用いて256ビットに統一。
- 軽量 & 直感的:無駄を省いたシンプルな設計。
インストール
ezenc をプロジェクトに追加するには、以下のコマンドを実行してください。
pip install ezenc
使い方
import ezenc
# 暗号化
encrypted_data = ezenc.enc(b"hello!", b"test-key")
print(encrypted_data)
# 復号
decrypted_data = ezenc.dec(encrypted_data, b"test-key")
print(decrypted_data) # 出力: b'hello!'
仕組み
- 指定したキーは内部でハッシュ関数を用いて256ビットに変換されます。
enc関数で平文をAES暗号化し、バイト列として出力します。dec関数を使うと、同じキーを用いて元のデータを復元できます。
注意点
- 暗号化と復号で 同じキー を使用してください。異なるキーを使うと復号できません。
ezencは内部でキーを256ビットに統一するため、キーの長さを気にする必要はありません。
ライセンス
本プロジェクトはオープンソースです。自由に使用・改変してください。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ezenc-0.1.0.tar.gz.
File metadata
- Download URL: ezenc-0.1.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1252c4fc8b0b40059a96510cedc6eacaab920e83e6a1600a6267124ca3c275cc
|
|
| MD5 |
ebd0d33069f0dbafe77069bda0c50c80
|
|
| BLAKE2b-256 |
0ad97c4f238f45064129e40bdae18d32d5e769027467df46efba08e086c8ae27
|
File details
Details for the file ezenc-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ezenc-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e5684875a7386d5ad7445f4e312f2275d442181d81801fb20232aec93cf0e48
|
|
| MD5 |
72f70c7091d5044db2dad23fa66685c6
|
|
| BLAKE2b-256 |
5665a644e089825468b9efb9ff43c044688c393bcfbbe7bdf9bf05cf1e28f654
|