ZIP spec.txt 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. Here are the notes I made while working through the ZIP file specification.
  2. For each file:
  3. local file header signature 4 bytes (0x04034b50)
  4. version needed to extract 2 bytes
  5. general purpose bit flag 2 bytes
  6. compression method 2 bytes
  7. last mod file time 2 bytes
  8. last mod file date 2 bytes
  9. crc-32 4 bytes
  10. compressed size 4 bytes
  11. uncompressed size 4 bytes
  12. file name length 2 bytes
  13. extra field length 2 bytes
  14. |sig |v |g |c |t |d |crc |csz |usz |n |x |
  15. PK.. ## 00 00 ?? ?? xxxx ???? ???? ?? 00
  16. <file name><file data>
  17. Central directory:
  18. central file header signature 4 bytes (0x02014b50)
  19. version made by 2 bytes
  20. version needed to extract 2 bytes *
  21. general purpose bit flag 2 bytes *
  22. compression method 2 bytes *
  23. last mod file time 2 bytes *
  24. last mod file date 2 bytes *
  25. crc-32 4 bytes *
  26. compressed size 4 bytes *
  27. uncompressed size 4 bytes *
  28. file name length 2 bytes *
  29. extra field length 2 bytes *
  30. file comment length 2 bytes
  31. disk number start 2 bytes
  32. internal file attributes 2 bytes
  33. external file attributes 4 bytes
  34. relative offset of local header 4 bytes
  35. file name (variable size)
  36. extra field (variable size)
  37. file comment (variable size)
  38. |sig |vm|vx|g |c |d |t |crc |csz |usz |n |x |cm|dn|ia|xa |roff|
  39. PK.. ## ## 00 00 ?? ?? xxxx ???? ???? ?? 00 00 00 00 xxxx ????
  40. End of central directory:
  41. end of central dir signature 4 bytes (0x06054b50)
  42. number of this disk 2 bytes
  43. number of the disk with the
  44. start of the central directory 2 bytes
  45. total number of entries in the
  46. central directory on this disk 2 bytes
  47. total number of entries in
  48. the central directory 2 bytes
  49. size of the central directory 4 bytes
  50. offset of start of central
  51. directory with respect to
  52. the starting disk number 4 bytes
  53. .ZIP file comment length 2 bytes
  54. .ZIP file comment (variable size)
  55. |sig |n1|n2|e |ne|size|off |cm|
  56. PK.. 00 00 ?? ?? ???? ???? 00