Skip to content

Commit

Permalink
examples, docs, version
Browse files Browse the repository at this point in the history
  • Loading branch information
radumarias committed Jun 3, 2024
1 parent 8d85d37 commit 0f3cd09
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zeroize"
version = "0.1.6"
version = "0.1.7"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ It uses [zeroize](https://crates.io/crates/zeroize) crate under the hood.
It can work with `bytearray` and `numpy array`.

> [!WARNING]
> **In the case of [Copy-on-write fork](https://en.wikipedia.org/wiki/Copy-on-write) you should zeroize the memory before fork the child process, see example below.
> Also by itself it doesn't work if memory is moved or moved to swap file. You can use `crypes` with `libc.mlock()` to lock the memory, see example below.**
> **In the case of [Copy-on-write fork](https://en.wikipedia.org/wiki/Copy-on-write) you need to zeroize the memory before forking the child process, see example below.
> Also by itself it doesn't work if memory is moved or moved to swap. You can use `crypes` with `libc.mlock()` to lock the memory, see example below.**
# Examples

Expand Down
2 changes: 2 additions & 0 deletions examples/lock_and_zeroize.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""By itself it doesn't work if memory is moved or moved to swap. You can use `crypes` with `libc.mlock()` to lock the memory"""

from zeroize import zeroize1, zeroize_np
import numpy as np
import ctypes
Expand Down
6 changes: 3 additions & 3 deletions examples/zeroize_before_fork.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
""" In the case of [Copy-on-write fork](https://en.wikipedia.org/wiki/Copy-on-write) you need to zeroize the memory before forking the child process. """

import os
from zeroize import zeroize1, zeroize_np
import numpy as np
from zeroize import zeroize1
import ctypes


Expand Down Expand Up @@ -51,4 +52,3 @@ def unlock_memory(buffer):
# Unlock the memory
print("unlocking memory")
unlock_memory(sensitive_data)

0 comments on commit 0f3cd09

Please sign in to comment.