RAR 헤더 플래그 비트 해석
RAR 포멧을 분석하는 도중 헤더 플래그의 비트 조합이 이해가 되지 않아 이렇게 질문을 올립니다.
제가 알고 싶은 내용은 다음과 같이 나열된 헤더플래그 비트를 어떻게 풀어나가야 하는가에 대한 것이며,
저장된 두개의 헤더플래그 비트는 다음과 같습니다.
1) 0x20 0x90 => ?
2) 0x40 0x90 => ?
3) 0x20 0x94 => ?
그리고, 표준 RAR 포멧 문서중 헤더 플래그( 2바이트 사용 )는 다음과 같이 명시되어 있습니다.
------------------------------------------------------------------------------
HEAD_FLAGS Bit flags:
2 bytes
0x01 - file continued from previous volume
0x02 - file continued in next volume
0x04 - file encrypted with password
0x08 - file comment present
RAR 3.x uses the separate comment block
and does not set this flag.
0x10 - information from previous files is used (solid flag)
(for RAR 2.0 and later)
bits 7 6 5 (for RAR 2.0 and later)
0 0 0 - dictionary size 64 KB
0 0 1 - dictionary size 128 KB
0 1 0 - dictionary size 256 KB
0 1 1 - dictionary size 512 KB
1 0 0 - dictionary size 1024 KB
1 0 1 - dictionary size 2048 KB
1 1 0 - dictionary size 4096 KB
1 1 1 - file is directory
0x100 - HIGH_PACK_SIZE and HIGH_UNP_SIZE fields
are present. These fields are used to archive
only very large files (larger than 2Gb),
for smaller files these fields are absent.
0x200 - FILE_NAME contains both usual and encoded
Unicode name separated by zero. In this case
NAME_SIZE field is equal to the length
of usual name plus encoded Unicode name plus 1.
0x400 - the header contains additional 8 bytes
after the file name, which are required to
increase encryption security (so called 'salt').
0x800 - Version flag. It is an old file version,
a version number is appended to file name as ';n'.
0x1000 - Extended time field present.
0x8000 - this bit always is set, so the complete
block size is HEAD_SIZE + PACK_SIZE
(and plus HIGH_PACK_SIZE, if bit 0x100 is set)
------------------------------------------------------------------------------
rar 포맷은 little endian일 겁니다. 그러니까 파일에서 2바
rar 포맷은 little endian일 겁니다. 그러니까 파일에서 2바이트가 0x20 0x90 으로
되어 있다면 이것은 0x9020을 나타내는 것이죠. 이진수로 표현하면
이걸 위의 포맷에 따라 해석하면 단일 압축 파일이고 코멘트, 패스워드 없고
dictionary size는 128 kB, Extended time field 있음... 등이 됩니다.
댓글 달기