| File | Date | Author | Commit |
|---|---|---|---|
| bench | 1 day ago |
|
[4fe6da] PH2 release |
| cli | 1 day ago |
|
[4fe6da] PH2 release |
| include | 1 day ago |
|
[4fe6da] PH2 release |
| src | 1 day ago |
|
[4fe6da] PH2 release |
| tests | 1 day ago |
|
[4fe6da] PH2 release |
| .gitignore | 1 day ago |
|
[d9f584] Initial commit |
| CMakeLists.txt | 1 day ago |
|
[4fe6da] PH2 release |
| LICENSE | 1 day ago |
|
[d9f584] Initial commit |
| README.md | 1 day ago |
|
[4fe6da] PH2 release |
PetoronHash2 (PH2) is a standalone ARX-based sponge construction that
combines:
PH2 is designed as a wide-state cryptographic primitive with explicit
domain separation and configurable output length.
The construction follows a sponge/duplex model where the state is split
into:
This separation ensures that only part of the internal state is used for
I/O, while the remaining portion acts as hidden entropy capacity.
PH2 implements its own wide ARX permutation:
The permutation operates over the full 4096-bit state and is invoked
during absorb and squeeze phases.
PH2 uses structured domain tagging to prevent cross-mode collisions. The
following absorb tags are used internally:
This ensures strict separation between contexts such as hashing, key
derivation, and parameter injection.
High-throughput hashing/XOF mode.
Recommended for: - File hashing - Large data streaming - General-purpose
hashing
Memory-hard construction with configurable memory and passes.
Recommended for: - Password hashing - Key derivation (KDF) - Brute-force
resistance
Supports constant-time memory indexing via --ct.
Extended time-hard + memory-hard mode.
Recommended for: - Deliberately slow derivation - Stress-resistant
derivation - High-cost computation scenarios
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
ctest --test-dir build --output-on-failure
./build/cli/ph2selftest
Tests include:
cd ~/PetoronHash2
./build/bench/ph2_bench fast
./build/bench/ph2_bench fast 64 30 512
./build/bench/ph2_bench fast 256 10 1024
./build/bench/ph2_bench hard $((128*1024*1024)) 4 512
./build/bench/ph2_bench hard $((128*1024*1024)) 4 512 --ct
./build/bench/ph2_bench burn $((128*1024*1024)) 4 $((1<<20)) 512
./build/bench/ph2_bench burn $((128*1024*1024)) 4 $((1<<20)) 512 --ct
PH2 BENCH fast: msg=256 MiB iters=10 out_bits=512
avg: 281.623 ms (909.0 MiB/s)
best: 280.280 ms (913.4 MiB/s)
digest(16B): 7b0eed7619f19321cbc6abbea9aaaace
PH2 BENCH fast: msg=64 MiB iters=30 out_bits=512
avg: 72.256 ms (885.7 MiB/s)
best: 70.097 ms (913.0 MiB/s)
digest(16B): d6d8d618f9136cb159041490aa817e52
PH2 BENCH hard: m_bytes=134217728 t_passes=4 out_bits=512 ct=0
time: 1.871 s
digest(16B): 28dc8f510ea7fcac20b79ea46300ae87
PH2 BENCH burn: m_bytes=134217728 t_passes=4 s_steps=1048576 out_bits=512 ct=0
time: 4.798 s
digest(16B): 4ad20f3c70697a5878d72da932ad24e4
--ct when constant-time memory access is required.Petoron | Ivan Alekseev | MIT license