#------------------------------------------------------------------------------
-# $File: compress,v 1.64 2015/07/27 15:41:09 christos Exp $
+# $File: compress,v 1.65 2015/12/04 20:48:03 christos Exp $
# compress: file(1) magic for pure-compression formats (no archives)
#
# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
0 lelong 0x184c2102 LZ4 compressed data (v0.1-v0.9)
!:mime application/x-lz4
+# Zstandard/LZ4 skippable frames
+# https://github.com/facebook/zstd/blob/dev/zstd_compression_format.md
+0 lelong&0xFFFFFFF0 0x184D2A50
+>(4.l+8) indirect
+
+# Zstandard Dictionary ID subroutine
+0 name zstd-dictionary-id
+# Single Segment = True
+>0 byte &0x20 \b, Dictionary ID:
+>>0 byte&0x03 0 None
+>>0 byte&0x03 1
+>>>1 byte x %u
+>>0 byte&0x03 2
+>>>1 leshort x %u
+>>0 byte&0x03 3
+>>>1 lelong x %u
+# Single Segment = False
+>0 byte ^0x20 \b, Dictionary ID:
+>>0 byte&0x03 0 None
+>>0 byte&0x03 1
+>>>2 byte x %u
+>>0 byte&0x03 2
+>>>2 leshort x %u
+>>0 byte&0x03 3
+>>>2 lelong x %u
+
+# Zstandard compressed data
+# https://github.com/facebook/zstd/blob/dev/zstd_compression_format.md
+0 lelong 0xFD2FB522 Zstandard compressed data (v0.2)
+!:mime application/x-zstd
+0 lelong 0xFD2FB523 Zstandard compressed data (v0.3)
+!:mime application/x-zstd
+0 lelong 0xFD2FB524 Zstandard compressed data (v0.4)
+!:mime application/x-zstd
+0 lelong 0xFD2FB525 Zstandard compressed data (v0.5)
+!:mime application/x-zstd
+0 lelong 0xFD2FB526 Zstandard compressed data (v0.6)
+!:mime application/x-zstd
+0 lelong 0xFD2FB527 Zstandard compressed data (v0.7)
+!:mime application/x-zstd
+>4 use zstd-dictionary-id
+0 lelong 0xFD2FB528 Zstandard compressed data (v0.8+)
+!:mime application/x-zstd
+>4 use zstd-dictionary-id
+
+# https://github.com/facebook/zstd/blob/dev/zstd_compression_format.md
+0 lelong 0xEC30A437 Zstandard dictionary
+!:mime application/x-zstd-dictionary
+>4 lelong x (ID %u)
+
# AFX compressed files (Wolfram Kleff)
2 string -afx- AFX compressed file data
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.97 2016/05/13 23:02:28 christos Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.98 2016/06/28 16:38:26 christos Exp $")
#endif
#include "magic.h"
static const char *lz4_args[] = {
"lz4", "-cd", NULL
};
+static const char *zstd_args[] = {
+ "zstd", "-cd", NULL
+};
private const struct {
const void *magic;
{ "\3757zXZ\0", 6, xz_args }, /* XZ Utils */
{ "LRZI", 4, lrzip_args }, /* LRZIP */
{ "\004\"M\030",4, lz4_args }, /* LZ4 */
+ { "\x28\xB5\x2F\xFD", 4, zstd_args }, /* zstd */
#ifdef ZLIBSUPPORT
{ zlibcmp, 0, zlib_args }, /* zlib */
#endif
--- /dev/null
+Zstandard compressed data (v0.8+), Dictionary ID: 1
\ No newline at end of file
--- /dev/null
+Zstandard dictionary (ID 0)
\ No newline at end of file
--- /dev/null
+Zstandard dictionary (ID 1)
\ No newline at end of file
--- /dev/null
+Zstandard dictionary (ID 285212672)
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.2)
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.3)
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.4)
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.8+), Dictionary ID: 1
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.2)
\ No newline at end of file
--- /dev/null
+"µ/ýÿ\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.3)
\ No newline at end of file
--- /dev/null
+#µ/ýÿ\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.4)
\ No newline at end of file
--- /dev/null
+$µ/ýÿ\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.5)
\ No newline at end of file
--- /dev/null
+%µ/ýÿ\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.6)
\ No newline at end of file
--- /dev/null
+&µ/ýÿ\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.7), Dictionary ID: None
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.7), Dictionary ID: 1
\ No newline at end of file
--- /dev/null
+'µ/ý!\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.7), Dictionary ID: 513
\ No newline at end of file
--- /dev/null
+'µ/ý"\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.8+), Dictionary ID: None
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.8+), Dictionary ID: 2
\ No newline at end of file
--- /dev/null
+(µ/ý\ 1\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.8+), Dictionary ID: 770
\ No newline at end of file
--- /dev/null
+(µ/ý\ 2\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.8+), Dictionary ID: 84148994
\ No newline at end of file
--- /dev/null
+(µ/ý\ 3\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.8+), Dictionary ID: 770
\ No newline at end of file
--- /dev/null
+(µ/ý\16\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.8+), Dictionary ID: None
\ No newline at end of file
--- /dev/null
+(µ/ý \ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.8+), Dictionary ID: 1
\ No newline at end of file
--- /dev/null
+(µ/ý!\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.8+), Dictionary ID: 513
\ No newline at end of file
--- /dev/null
+(µ/ý"\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.8+), Dictionary ID: 67305985
\ No newline at end of file
--- /dev/null
+(µ/ý#\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.8+), Dictionary ID: None
\ No newline at end of file
--- /dev/null
+(µ/ýô\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
--- /dev/null
+Zstandard compressed data (v0.8+), Dictionary ID: 67305985
\ No newline at end of file
--- /dev/null
+(µ/ýÿ\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file