You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
```
Benchmark2kJitter-32 67309 17580 ns/op 116.50 MB/s 3478 B/op 17 allocs/op
Benchmark2kJitterParanoid-32 54398 21564 ns/op 94.97 MB/s 3438 B/op 16 allocs
```
### Paranoid?
The padding size is determined by the remainder of a CRC32 of the content.
Since the payload contains elements unknown to the attacker, there is no reason to believe they can derive any information
from this remainder, or predict it.
However, for those that feel uncomfortable with a CRC32 being used for this can enable "paranoid" mode which will use SHA256 for determining the padding.
The hashing itself is about 2 orders of magnitude slower, but in overall terms will maybe only reduce speed by 10%.
Paranoid mode has no effect if buffer is < 0 (non-content aware padding).
The jitter is added as a "Comment" field. This field has a 1 byte overhead, so actual extra size will be 2 -> n+1 (inclusive).
245
246
246
-
A good option would be to apply 32 random bytes, with default 64KB buffer: `gzhttp.RandomJitter(32, 0)`.
247
+
A good option would be to apply 32 random bytes, with default 64KB buffer: `gzhttp.RandomJitter(32, 0, false)`.
247
248
248
249
Note that flushing the data forces the padding to be applied, which means that only data before the flush is considered for content aware padding.
249
250
250
251
The *padding* in the comment is the text `Padding-Padding-Padding-Padding-Pad....`
251
252
252
-
The *length* is `1 + sha256(payload) MOD n`, or just random from `crypto/rand` if buffer < 0.
253
+
The *length* is `1 + crc32c(payload) MOD n` or `1 + sha256(payload) MOD n` (paranoid), or just random from `crypto/rand` if buffer < 0.
254
+
255
+
### Paranoid?
256
+
257
+
The padding size is determined by the remainder of a CRC32 of the content.
258
+
259
+
Since the payload contains elements unknown to the attacker, there is no reason to believe they can derive any information
260
+
from this remainder, or predict it.
261
+
262
+
However, for those that feel uncomfortable with a CRC32 being used for this can enable "paranoid" mode which will use SHA256 for determining the padding.
263
+
264
+
The hashing itself is about 2 orders of magnitude slower, but in overall terms will maybe only reduce speed by 10%.
265
+
266
+
Paranoid mode has no effect if buffer is < 0 (non-content aware padding).
0 commit comments