From b9479953db8db296733f415c4af195bdbdcaef87 Mon Sep 17 00:00:00 2001 From: Amis Shokoohi Date: Fri, 24 Feb 2023 00:02:21 +0330 Subject: [PATCH] Update to v4.0.0 --- CHANGELOG.md | 6 +++++ README.md | 62 ++++++++++++++++++++++++++++++-------------- pyproject.toml | 2 +- src/kapak/version.py | 2 +- 4 files changed, 50 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e858a2..751db5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [4.0.0] + +### Changed + +- `1ba75a5` Bumped cryptography from 39.0.0 to 39.0.1 + ## [4.0.0-rc.2] ### Added diff --git a/README.md b/README.md index 3ec5556..96a5bc5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ -

- -

+
+ kapak - A simple-to-use file encryption script +
+ +
[![tests](https://github.com/amis-shokoohi/kapak/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/amis-shokoohi/kapak/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/amis-shokoohi/kapak/branch/main/graph/badge.svg?token=6W2V3QOZKP)](https://codecov.io/gh/amis-shokoohi/kapak) @@ -10,9 +15,13 @@ ![GitHub Repo stars](https://img.shields.io/github/stars/amis-shokoohi/kapak) ![GitHub forks](https://img.shields.io/github/forks/amis-shokoohi/kapak) -# kapak: A simple-to-use file encryption script +
+ +**Kapak** is a simple-to-use **file encryption** script/library.
+It uses `AES_256_CBC` as its encryption cipher. + +> If you are wondering what _kapak_ means, it means _mold_. -- [Description](#description) - [Installation](#installation) - [CLI Usage](#cli-usage) - [Encrypt file](#cli-usage-encrypt-file) @@ -21,21 +30,14 @@ - [Integration](#integration) - [Encrypt file](#integration-encrypt-file) - [Encrypt stdin](#integration-encrypt-stdin) - - - -## Description - -Kapak is a simple-to-use **file encryption** script.
-It uses `AES_256_CBC` as its encryption cipher and
-`scrypt` key derivation algorithm to generate a 256 bit key. - -> If you are wondering what _kapak_ means, it means _mold_. + - [Encrypt anything](#integration-encrypt-anything) ## Installation +Installing with `pip`: + ``` pip install kapak ``` @@ -156,12 +158,11 @@ with input_file.open("rb") as src, output_file.open("wb") as dst: ### Encrypt stdin ```py -import io import sys -import base64 +from io import BytesIO from kapak.aes import encrypt -with io.BytesIO() as dst: +with BytesIO() as dst: for _ in encrypt( src=sys.stdin.buffer, dst=dst, @@ -170,6 +171,27 @@ with io.BytesIO() as dst: ): pass encrypted_data = dst.getvalue() - encrypted_data_base64 = base64.standard_b64encode(encrypted_data) - print(encrypted_data_base64.decode("utf-8")) + print(encrypted_data.hex()) +``` + + + +### Encrypt anything + +```py +from io import BytesIO +from kapak.aes import encrypt + +anything = b"anything" + +with BytesIO(anything) as src, BytesIO() as dst: + for _ in encrypt( + src=src, + dst=dst, + password="P@ssw0rd", + buffer_size=1024 + ): + pass + encrypted_data = dst.getvalue() + print(encrypted_data.hex()) ``` diff --git a/pyproject.toml b/pyproject.toml index 7346fcc..d91028e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "kapak" -version = "4.0.0-rc.2" +version = "4.0.0" description = "A simple-to-use file encryption script" authors = ["Amis Shokoohi "] license = "Apache-2.0" diff --git a/src/kapak/version.py b/src/kapak/version.py index 479b3e4..ce1305b 100644 --- a/src/kapak/version.py +++ b/src/kapak/version.py @@ -1 +1 @@ -__version__ = "4.0.0-rc.2" +__version__ = "4.0.0"