Zip 압축파일 Header 구조



사용자 삽입 이미지


< Zip 파일의 내부 구조 분석 >


사용자 삽입 이미지1. Local File Header(30byte: 가변값 제외)
     local file header signature  – 4 bytes – (0x04034b50) : 고유 값
     version needed to extract    – 2 bytes
     general purpose bit flag     – 2 bytes
     compression method           – 2 bytes
     last mod file time           – 2 bytes
     last mod file date           – 2 bytes
     crc-32                       – 4 bytes
     compressed size              – 4 bytes
     uncompressed size            – 4 bytes
     file name length             – 2 bytes
     extra field length           – 2 bytes
     file name (variable size)
     extra field (variable size)


2. Central File Header(46byte: 가변값 제외)
     central file header signature – 4 bytes – (0x02014b50) : 고유 값
     version made by               – 2 bytes
     version needed to extract     – 2 bytes
     general purpose bit flag      – 2 bytes
     compression method            – 2 bytes
     last mod file time            – 2 bytes
     last mod file date            – 2 bytes
     crc-32                        – 4 bytes
     compressed size               – 4 bytes
     uncompressed size             – 4 bytes
     file name length              – 2 bytes
     extra field length            – 2 bytes
     file comment length           – 2 bytes
     disk number start             – 2 bytes
     internal file attributes      – 2 bytes
     external file attributes      – 4 bytes
     relative offset of local header 4 bytes
     file name (variable size)
     extra field (variable size)
     file comment (variable size)


3. End Header(22byte: comment 제외)
     end of central dir signature  – 4 bytes – (0x06054b50) : 고유값
     number of this disk           – 2 bytes
     number of the disk with the start of the central directory    – 2 bytes
     total number of entries in the central directory on this disk – 2 bytes
     total number of entries in the central directory              – 2 bytes
     size of the central directory – 4 bytes
     offset of start of central directory with respect to the starting disk number – 4 bytes
     .ZIP file comment length      – 2 bytes
     .ZIP file comment (variable size)
 
*참고 사이트:
 zip 알고리즘(Deflate) – http://ko.wikipedia.org/wiki/DEFLATE, http://en.wikipedia.org/wiki/DEFLATE
 LZ 77 알고리즘 – http://home.postech.ac.kr/~ehoto/lz77.htm

 ZIP File Format Specification – http://www.pkware.com/documents/casestudies/APPNOTE.TXT

 zlib Home page – http://www.zlib.net/
 Winimage.com minizip – http://www.winimage.com/zLibDll/minizip.html

 Zlib Library Manual – http://kaistizen.net/project/Zip/Index.htm
 Zlib 활용(글쓴이: 윤상배) – http://www.joinc.co.kr/modules/moniwiki/wiki.php/article/zlib_prog

You may also like...

댓글 남기기