Skip to content

Commit ca02910

Browse files
committed
chore: more comments on readme
1 parent 9ab451d commit ca02910

File tree

1 file changed

+94
-2
lines changed

1 file changed

+94
-2
lines changed

README.md

Lines changed: 94 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,24 @@
1414
* **Recoverable** – lose the preimage? Brute‑force time is **predictable** and set by *n* bits and Argon2id cost (see table). You decide whether recovery takes days, weeks or months.
1515
* **Coercion‑resistant** – stash the preimage **elsewhere**. If forced to hand over the key, you truthfully can’t; an attacker must steal the stash or spend the compute.
1616

17-
### Example application
17+
### Example application: Coercion-Resistant Vault
1818
Note: this is just an idea, we don't suggest this scheme as it was **not peer reviewed** and is a very advanced usage
1919
<img width="3333" height="1215" alt="image" src="https://github.com/user-attachments/assets/4b12e31a-60ef-4b8d-a753-4d500da2e4cc" />
2020

21-
See `scripts/complex-scheme.sh` for a related example.
21+
This two-layer scheme provides three distinct recovery paths for the final keyfile:
22+
23+
1. **Direct Access (seconds)**: If you have physical access to the second preimage (e.g., stored in a bank vault), you can derive the second key instantly and decrypt the final keyfile.
24+
25+
2. **Computational Recovery (days/weeks)**: If the second preimage is lost, you can brute-force the 24-bit search space. With sufficient computational resources, recovery is expensive but feasible.
26+
27+
3. **Time-Locked Recovery (30 days)**: Using the first preimage, you must wait for the 30-day derivation to complete, decrypt the second preimage, then derive the second key. This path provides guaranteed access but enforces a significant time delay - crucial for coercion resistance.
28+
29+
Under coercion, even if you provide all materials (both preimages, encrypted files, and parameters), an attacker must either:
30+
- Wait 30 days for the time-locked path, giving authorities time to intervene
31+
- Spend significant resources on computational recovery
32+
- Gain physical access to wherever you've stored the second preimage
33+
34+
See `scripts/complex-scheme.sh` for implementation details.
2235

2336
---
2437

@@ -256,3 +269,82 @@ Explanation:
256269
• Random (99.9th %): 99.9% chance completion is faster than this
257270
```
258271
---
272+
273+
## Computational Cost Estimation for Brute-Force Recovery
274+
275+
### Coercion-Resistant Vault Example (24-bit second preimage)
276+
277+
The `scripts/complex-scheme.sh` example uses these parameters for the second layer:
278+
- **Bit length**: 24 bits (16,777,216 possible values, but only 8,388,608 candidates since MSB=1)
279+
- **Argon2id parameters**: 7 iterations, 4GB memory
280+
- **Expected derivation time**: ~30 seconds per attempt (on typical hardware)
281+
282+
### Time Requirements
283+
284+
From the benchmark table above, brute-forcing a 24-bit preimage requires:
285+
- **16 threads** (desktop): 182 days worst-case
286+
- **128 threads** (single large instance): ~22.7 days expected
287+
- **2048 threads** (distributed cluster): 1.4 days expected, 6.5 days at 99th percentile
288+
289+
### Cloud Computing Cost Analysis
290+
291+
#### AWS EC2 Pricing (as of 2024)
292+
For memory-hard operations requiring 4GB per thread:
293+
294+
**Option 1: High-Memory Instances**
295+
- Instance type: `r6i.32xlarge` (128 vCPUs, 1024 GB RAM)
296+
- Can run 128 parallel threads (1 per vCPU, each using 4GB RAM)
297+
- Cost: ~$8.06/hour
298+
- Time needed: ~22.7 days (with 128 threads)
299+
- **Total cost: ~$4,390**
300+
301+
**Option 2: Compute-Optimized Cluster**
302+
- Instance type: `c6i.4xlarge` (16 vCPUs, 32 GB RAM)
303+
- Can run 8 parallel threads (limited by RAM: 32GB/4GB = 8)
304+
- Cost: ~$0.68/hour per instance
305+
- Need 256 instances for 2048 threads
306+
- Time needed: ~1.4 days expected
307+
- **Total cost: ~$5,850** (expected case)
308+
- **Total cost: ~$27,000** (99th percentile, 6.5 days)
309+
310+
**Option 3: Spot Instances**
311+
- Using spot pricing can reduce costs by 60-90%
312+
- Less reliable, may be interrupted
313+
- **Estimated cost: $1,000-$10,000** depending on availability
314+
315+
#### Other Cloud Providers
316+
317+
**Google Cloud Platform**
318+
- `n2-highmem-128` (128 vCPUs, 864 GB RAM)
319+
- Can run 128 parallel threads (1 per vCPU)
320+
- Cost: ~$6.74/hour
321+
- Time needed: ~22.7 days
322+
- **Total cost: ~$3,670**
323+
324+
**Local Hardware Investment**
325+
- 64-core AMD Threadripper: ~$4,000
326+
- 256GB RAM: ~$1,000
327+
- Can run 64 threads continuously
328+
- Time: ~45 days
329+
- **One-time cost: ~$5,000** (reusable hardware)
330+
331+
### Cost Factors to Consider
332+
333+
1. **CPU vs Memory Constraints**: Argon2id is CPU-intensive; you can only run one thread per CPU core effectively
334+
2. **Memory Requirements**: Each thread needs 4GB RAM, which can limit thread count on lower-memory instances
335+
3. **Spot vs On-Demand**: Spot instances can reduce costs by 60-90% but may be interrupted
336+
4. **Coordination Overhead**: Managing 2048 threads across 256+ machines requires significant orchestration
337+
5. **Electricity Costs**: For local hardware, add ~$200-500 for 45 days of operation
338+
339+
### Conclusion
340+
341+
Realistic cost estimates for brute-forcing a 24-bit preimage:
342+
- **Budget approach**: $1,000-$5,000 using spot instances or local hardware
343+
- **Fast approach**: $6,000-$30,000 for on-demand cloud computing
344+
- **Worst case**: Higher costs if extremely unlucky (99.9th percentile)
345+
346+
These costs make brute-force recovery feasible for high-value assets while remaining prohibitively expensive for casual attackers. The actual cost depends heavily on:
347+
- Current cloud pricing
348+
- Luck in finding the preimage
349+
- Available optimization techniques
350+
- Whether time or money is the primary constraint

0 commit comments

Comments
 (0)