文件头魔数

很多类型的文件,其起始的几个字节的内容是固定的(或是有意填充,或是本就如此)。
根据这几个字节的内容就可以确定文件类型,因此这几个字节的内容被称为魔数 (magic number)。

JPEG                             jpg;jpeg                      0xFFD8FF
PNG                              png                           0x89504E470D0A1A0A
GIF                              gif                           GIF8
TIFF                             tif;tiff                      0x49492A00
TIFF                             tif;tiff                      0x4D4D002A
AOL ART                          art                           0x4A47040E000000
AOL ART                          art                           0x4A47030E000000
PC Paintbrush                    pcx                           0x0A050108
Graphics Metafile                wmf                           0xD7CDC69A
Graphics Metafile                wmf                           0x01000900
Graphics Metafile                wmf                           0x02000900
Enhanced Metafile                emf                           0x0100000058000000
CAD                              dwg                           0x41433130
Outlook Express                  dbx                           0xCFAD12FE
MS Office/OLE2     doc;xls;dot;ppt;xla;ppa;pps;pot;msi;sdw;db  0xD0CF11E0A1B11AE1
WordPerfect                      wpd                           0xFF575043
Quicken                          qdf                           0xAC9EBD8F
QuickBooks Backup                qbb                           0x458600000600
Sage               sly.or.srt.or.slt;sly;srt;slt               0x53520100
Lotus WordPro v9                 lwp                           0x576F726450726F
Lotus 123 v9                     123                           0x00001A00051004
Lotus 123 v5                     wk4                           0x00001A0002100400
Lotus 123 v3                     wk3                           0x00001A0000100400
Lotus 123 v1                     wk1                           0x2000604060
Windows Password                 pwl                           0xE3828596
ZIP Archive                      zip;jar                       0x504B0304
ZIP Archive (outdated)           zip                           0x504B3030
GZ Archive                       gz;tgz                        0x1F8B08
ARJ Archive                      arj                           0x60EA
MPEG                             mpg;mpeg                      0x000001BA
MPEG                             mpg;mpeg                      0x000001B3
Windows Media                    asf                           0x3026B2758E66CF11
ELF Executable                   elf;;                         0x7F454C4601010100 
Java-Class                      class                          0xCAFEBASE
posted @ 2017-02-18 10:10  relucent  阅读(5586)  评论(0编辑  收藏  举报