(Click to enlarge)

Explicit Optimal Binary Pebbling for One-Way Hash Chain Reversal

Last updated Saturday, 13-Apr-2024 10:16:42 CEST by Berry Schoenmakers.

Now available: paper Binary Pebbling Algorithms for In-Place Reversal of One-Way Hash Chains from Nieuw Archief voor Wiskunde, September 2017 issue, in which the main results of the FC 2016 paper are highlighted, with illustrations.

Also available: Financial Crypto 2016 slides, Multiparty (MPC) One-Way Hash Chains.

Sample code using the SHA-256 hash function

The paper (IACR eprint 2014/329) presents pseudocode for three novel algorithms for hash chain reversal:
  1. In-place Jakobsson's speed-2 binary pebbles
  2. In-place optimal binary pebbles
  3. Fast optimal binary pebbles
Algorithm 3 maximizes speed at the expense of some additional storage, which is of interest when the hash function is implemented in hardware (e.g., using Intel's AES-NI).

The sample programs below print the length-2k hash chain with default seed value x = "" (empty input) in reverse.

Programs are available in Python, C (plain ANSI C, compile with e.g. gcc -O3 -lcrypto), and Java. The code closely follows the pseudocode in the paper. Note that the programs start out computing the hash chain in the forward direction, and then loop outputting the reversed hash chain one element at a time.

For downloadable code, see src/readme.txt.

Sample output for k = 3:

30edbc354e8cf656adcddbeefbf3f5073372cdc42e4eca2e797bda8abebb6a05
06adb8ba851d855951490003c3c1fe4d3a2e6cd87a1299208ddfd3949d131657
1bee5a29daf06786a5516d9226b30bbdbf422a7ed475e42c3f930ea04c612091
9ff42bc5a042d3c79a61d7cb6769408fe13b1e5fc30e01e19a100e79109ed688
75d7682c8b5955557b2ef33654f31512b9b3edd17f74b5bf422ccabbd7537e1a
aa6ac2d4961882f42a345c7615f4133dde8e6d6e7c1b6b40ae4ff6ee52c393d0
5df6e0e2761359d30a8275058e299fcc0381534545f55cf43e41983f5d4c9456
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

In-place Jakobsson's speed-2 pebbles

Python code:

C code:

Java code:
<

In-place optimal binary pebbles

Python code:

C code:

Java code:

Optimal binary pebbles optimized for speed

Python code:

C code:

Java code: