From 5f8274425b530bc03d90e0bd07a17b6935e4c212 Mon Sep 17 00:00:00 2001 From: Radu Marias Date: Sun, 2 Jun 2024 03:49:51 +0300 Subject: [PATCH] doc --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 5 ++++- main.py | 10 ++++++++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6944330..7af2b4f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -366,7 +366,7 @@ checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "zeroize" -version = "0.1.3" +version = "0.1.4" dependencies = [ "numpy", "pyo3", diff --git a/Cargo.toml b/Cargo.toml index 75582db..51b688c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zeroize" -version = "0.1.3" +version = "0.1.4" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/README.md b/README.md index 47cdeb4..ceafceb 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,15 @@ arr = bytearray(b'1234567890') arr_np = np.array([0] * 10, dtype=np.uint8) arr_np[:] = arr assert arr_np.tobytes() == b'1234567890' + +print("zeroize'ing...: ") zeroize.zeroize1(arr) zeroize.zeroize_np(arr_np) -print("zeroize'ing...: ") + print("checking if is zeroized...") assert arr == bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') assert all(arr_np == 0) + print("all good, bye!") ``` # Building from source diff --git a/main.py b/main.py index 5e6bc71..682ca4b 100644 --- a/main.py +++ b/main.py @@ -2,14 +2,20 @@ import numpy as np +# regular array arr = bytearray(b'1234567890') + +# numpy array arr_np = np.array([0] * 10, dtype=np.uint8) arr_np[:] = arr assert arr_np.tobytes() == b'1234567890' + +print("zeroize'ing...: ") zeroize.zeroize1(arr) zeroize.zeroize_np(arr_np) -print("zeroize'ing...: ") + print("checking if is zeroized...") assert arr == bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') assert all(arr_np == 0) -print("all good, bye!") \ No newline at end of file + +print("all good, bye!")