diff --git a/doc/zstd_compression_format.md b/doc/zstd_compression_format.md index cdad14f5866..c8b716713e0 100644 --- a/doc/zstd_compression_format.md +++ b/doc/zstd_compression_format.md @@ -296,6 +296,14 @@ in which case the frame may or may not need a dictionary to be decoded, and the ID of such a dictionary is not specified. The decoder must know this information by other means. +`Dictionary_ID` identifies a dictionary but does not verify its contents. +Different dictionaries can share the same ID, and decoding with the wrong +dictionary can produce incorrect output. Producers SHOULD include the optional +`Content_Checksum` in dictionary-compressed frames to help decoders that verify +it detect incorrect output. Checksums are optional and decoders may ignore them, +so this is only a partial integrity check; it does not authenticate a dictionary +or replace an authenticated dictionary-distribution mechanism. + #### `Frame_Content_Size` This is the original (uncompressed) size. This information is optional. diff --git a/programs/zstd.1 b/programs/zstd.1 index e49a182d506..77966a83ea8 100644 --- a/programs/zstd.1 +++ b/programs/zstd.1 @@ -140,6 +140,12 @@ Note: If \fBwindowLog\fR is set to larger than 27, \fB\-\-long=windowLog\fR or \ .IP "\(bu" 4 \fB\-D DICT\fR: use \fBDICT\fR as Dictionary to compress or decompress FILE(s) . +.IP +When compressing with a dictionary, keep the content checksum enabled +(\fB\-\-check\fR, the default) to help decoders detect a mismatched dictionary. +This only works when the decoder verifies the checksum and is not +cryptographic. +. .IP "\(bu" 4 \fB\-\-patch\-from FILE\fR: Specify the file to be used as a reference point for zstd\'s diff engine\. This is effectively dictionary compression with some convenient parameter selection, namely that \fIwindowSize\fR > \fIsrcSize\fR\. . diff --git a/programs/zstd.1.md b/programs/zstd.1.md index 1721441dfbb..4376991ebe4 100644 --- a/programs/zstd.1.md +++ b/programs/zstd.1.md @@ -168,6 +168,11 @@ the last one takes effect. `--memory=windowSize` needs to be passed to the decompressor. * `-D DICT`: use `DICT` as Dictionary to compress or decompress FILE(s) + + When compressing with a dictionary, keep the content checksum enabled + (`--check`, the default) to help decoders detect a mismatched dictionary. + This only works when the decoder verifies the checksum and is not + cryptographic. * `--patch-from FILE`: Specify the file to be used as a reference point for zstd's diff engine. This is effectively dictionary compression with some convenient parameter