handshake-org / handshake-org/hsd

Random Padding in P2P Messages

Open
#293 0 comments 0 reactions 0 assignees View on GitHub
discussion
Dominant language
JavaScript
Stars
2.1k
Forks
306
PR merge metrics
No merged PRs in 30d

Description

## Overview

From https://github.com/handshake-org/hsd/pull/287

```
* A future possibility may be to randomly pad out messages
* to avoid suspicion from a tyrannical government
* (todo: research/discuss this more).
```

Opening this issue to begin discussion.

Randomly padding the p2p messages is a bigger rabbit hole than I expected. Wikipedia has some good primers on the topic:

- https://en.wikipedia.org/wiki/Padding_(cryptography)#Traffic_analysis_and_protection_via_padding
- https://en.wikipedia.org/wiki/Traffic_analysis
- https://en.wikipedia.org/wiki/PURB_(cryptography)

There are two main types of padding schemes:
- Deterministic
- Places packets into buckets, padding each packet in a bucket to the same size
- Must choose bucket cutoffs wisely, many messages around the cutoff can leak information
- Can pad to a common size or to the next power of 2
- [Padme, Section 4](https://bford.info/pub/sec/purb.pdf)/[PURBS](https://en.wikipedia.org/wiki/PURB_(cryptography)) seem promising
- Random
- Statistical techniques can be used to deanonymize packets over time
- If random pad size is smaller than the packet, it doesn't give strong anonymity benefits over time
- If random pad size is larger than the packet, there is a large overhead

To account for the overhead that comes with padding all p2p messages with random data, an adapted version of Erlay could be used:
- https://github.com/naumenkogs/bips/blob/bip-reconcil/bip-reconcil.mediawiki
- https://arxiv.org/abs/1905.10518

## Implementation

- Could be added to `net` package or `brontide` package
- I think its a better idea to add it to the `brontide` package since that layer is responsible for encryption
- Does this block mainnet, or could it be soft forked in?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.