ZIP local file header 

Local header 는 아래와 같고 [http]위키리스트참고

ZIP local file header
Offset Bytes Description
0 4 Local file header signature = 0x04034b50 (read as a little-endian number)
4 2 Version needed to extract (minimum)
6 2 General purpose bit flag
8 2 Compression method
10 2 File last modification time
12 2 File last modification date
14 4 CRC-32
18 4 Compressed size
22 4 Uncompressed size
26 2 File name length (n)
28 2 Extra field length (m)
30 n File name
30+n m Extra field

위에 나온 것을 보고 분석해봅시다.
$ xxd test.zip | head -6
0000000: 504b 0304 0a00 0000 0000 2cb2 093f b537  PK........,..?.7
0000010: 3c98 1000 0000 1000 0000 0600 1c00 6161  <.............aa
0000020: 2e74 7874 5554 0900 0363 3341 4e6a 3341  .txtUT...c3ANj3A
0000030: 4e75 780b 0001 046b 0400 0004 f901 0000  Nux....k........
0000040: 3031 3233 3435 3637 3839 4142 4344 4546  0123456789ABCDEF
0000050: 504b 0304 0a00 0000 0000 2fb2 093f b537  PK......../..?.7


Offset Bytes Description Value
0 4 Local file header signature 504b 0304
4 2 Version needed to extract (minimum) 0a00
6 2 General purpose bit flag 0000
8 2 Compression method 0000
10 2 File last modification time 5189
12 2 File last modification date 093f
14 4 CRC-32 b537 3c98
18 4 Compressed size 1000 0000
22 4 Uncompressed size 1000 0000
26 2 File name length (n) 0600
28 2 Extra field length (m) 1c00
30 n(6) File name 6161 2e74 7874("aa.txt")
30+n m(1c) Extra field(1c == 28byte)
0900 0379 eb40 4e94 eb40 4e75 780b 0001
04e8 0300 0004 6400 0000
30+n+m Data 3031 3233 3435 3637 3839 4142 4344 4546 = "0123456789ABCDEF"

두번째

$ xxd test.zip |grep -A 5 0000050
0000050: 504b 0304 0a00 0000 0000 6089 093f b537  PK........`..?.7
0000060: 3c98 1000 0000 1000 0000 0600 1c00 6262  <.............bb
0000070: 2e74 7874 5554 0900 0394 eb40 4e94 eb40  .txtUT.....@N..@
0000080: 4e75 780b 0001 04e8 0300 0004 6400 0000  Nux.........d...
0000090: 3031 3233 3435 3637 3839 4142 4344 4546  0123456789ABCDEF
00000a0: 504b 0102 1e03 0a00 0000 0000 5189 093f  PK..........Q..?

Offset Bytes Description Value
0 4 Local file header signature 504b 0304
4 2 Version needed to extract (minimum) 0a00
6 2 General purpose bit flag 0000
8 2 Compression method 0000
10 2 File last modification time 6089
12 2 File last modification date 093f
14 4 CRC-32 b537 3c98
18 4 Compressed size 1000 0000
22 4 Uncompressed size 1000 0000
26 2 File name length (n) 0600
28 2 Extra field length (m) 1c00
30 n(6) File name 6262 2e74 7874("bb.txt")
30+n m(1c) Extra field(1c == 28byte)
5554 0900 0394 eb40 4e94 eb40 4e75 780b
0001 04e8 0300 0004 6400 0000
30+n+m Data 3031 3233 3435 3637 3839 4142 4344 4546 = "0123456789ABCDEF"

+ Recent posts