A library for simulating Arbiter PUFs and other delay-based PUFs.
Project description
APUF
A Python package for simulating delay-based Physical Unclonable Functions (PUFs) using Lim's Linear Additive Delay Model (LADM). This module supports Arbiter PUFs (APUFs) and XORPUFs. Provides challenge generation, response simulation (with noise), and bit-packing utilities.
Features
- $d$-layer Arbiter PUF (
APUF): simulate $d$ layers, compute $k$-bit responses given $k$ challenges ($d$-bit binary vectors). - XORPUF (
XORPUF): simulate multiple APUF instances, compute responses and XOR them for increased complexity. - Challenge generators:
generate_k_challenges(k, d, seed)generate_n_k_challenges(n, k, d, seed)generate_challenges_mp(n, k, d, seed, processes)for parallel batch generation.
- Response data-type (
Response): BothAPUFandXORPUFreturn a $k$-bit response given $k$ challenges.Responseprovides a conventient interface to study PUF challenge-response behaviours.
Installation
pip install apuf
Requires Python 3.9+ and
numpy.
Quick Start
Import the module and call the functions directly:
from apuf import APUF, XORPUF, generate_k_challenges
# 1) Single APUF
apuf = APUF(d=64, mean=0.0, std=0.05)
# 2) Generate 10 random challenges (phase vectors)
chals = generate_k_challenges(k=10, d=64, seed=42) # shape (65, 10)
# 3) Measure responses twice with Gaussian noise (mean=0, std=0.005)
resp1 = apuf.get_responses(chals, nmean=0.0, nstd=0.005)
resp2 = apuf.get_responses(chals, nmean=0.0, nstd=0.005)
# 4) Due to measurement noise, resp1 and resp2 may be different
diff = resp1 - resp2
# 4.1) We can compute Hamming distance
hamming_distance = resp1.dist(resp2)
# 4.2) And fractional/normalized HD
fHD = resp1.dist(resp2)/len(resp1)
# 5) Pack responses into bytes for convenience
resp_bytes = APUF.compact_responses(resp)
print(resp, resp_bytes)
API Reference
Below you will find a short reference for the core classes and functions.
Classes
Response - Represents a PUF response vector.
- Bitwise operations:
^,&,|,~ .dist(other)returns Hamming distance..hwreturns Hamming weight (number of 1s).
APUF(d: int = 128, mean: float = 0.0, std: float = 0.05) - Simulates a single APUF.
get_responses(chals: np.ndarray, nmean: float = 0.0, nstd: float = 0.005) -> Responsecompact_responses(resp: Response) -> bytes
XORPUF(children: list[APUF]) - Simulates an XORPUF by XORing responses of child APUFs.
get_responses(chals: np.ndarray) -> Response
Functions
generate_k_challenges(k: int, d: int, seed: int = None) -> np.ndarraygenerate_n_k_challenges(n: int, k: int, d: int, seed: int = None) -> np.ndarraygenerate_challenges_mp(n: int, k: int, d: int, seed: int = None, processes: int = cpu_count()) -> list[np.ndarray]
Full docstrings and type hints are available in code.
Testing
Run the provided unit tests with unittest:
git clone https://github.com/nikita-tripathi-geo/APUF-simulation.git
cd APUF-simulation
pip install -r requirements.txt
python -m unittest tests/*.py
Contributing
Contributions, issues and feature requests are welcome! Please see Issues.
License
This project is licensed under the MIT License – see the LICENSE file for details.
MIT License (c) Nikita Tripathi
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 apuf-0.2.0.tar.gz.
File metadata
- Download URL: apuf-0.2.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f92847b94fbf60074f93e32f09259ae84c960bf2c6154bacebc8411e889e36a
|
|
| MD5 |
bd156dfb0ab9aba7da5c79fbcc99a03d
|
|
| BLAKE2b-256 |
c9c8bb122f868cd2ba43538cbdea6e7c07c1c449f06c56e5381f94cb0d023512
|
Provenance
The following attestation bundles were made for apuf-0.2.0.tar.gz:
Publisher:
python-publish.yml on nikita-tripathi-geo/APUF-simulation
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
apuf-0.2.0.tar.gz -
Subject digest:
9f92847b94fbf60074f93e32f09259ae84c960bf2c6154bacebc8411e889e36a - Sigstore transparency entry: 215368690
- Sigstore integration time:
-
Permalink:
nikita-tripathi-geo/APUF-simulation@5fa66aeffa6ae3eac8ae70c60e19cad163a4a43a -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/nikita-tripathi-geo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@5fa66aeffa6ae3eac8ae70c60e19cad163a4a43a -
Trigger Event:
release
-
Statement type:
File details
Details for the file apuf-0.2.0-py3-none-any.whl.
File metadata
- Download URL: apuf-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba8af7bd49b0a5bea60766bff08fa1a13497096a59c449833c255108fcac0a21
|
|
| MD5 |
30a9dc6639a1a5a3df8c61dd3df56841
|
|
| BLAKE2b-256 |
5797aa9db6c11429d0a781ec926874f7d7263f6ba7c4eb08ce17a9325918af91
|
Provenance
The following attestation bundles were made for apuf-0.2.0-py3-none-any.whl:
Publisher:
python-publish.yml on nikita-tripathi-geo/APUF-simulation
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
apuf-0.2.0-py3-none-any.whl -
Subject digest:
ba8af7bd49b0a5bea60766bff08fa1a13497096a59c449833c255108fcac0a21 - Sigstore transparency entry: 215368691
- Sigstore integration time:
-
Permalink:
nikita-tripathi-geo/APUF-simulation@5fa66aeffa6ae3eac8ae70c60e19cad163a4a43a -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/nikita-tripathi-geo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@5fa66aeffa6ae3eac8ae70c60e19cad163a4a43a -
Trigger Event:
release
-
Statement type: