diff --git a/README.md b/README.md index f80022b..33dffcd 100644 --- a/README.md +++ b/README.md @@ -214,6 +214,8 @@ When encrypting, you have to encrypt the whole body. | :----------: | | 2023-07-11 | +HSSP Indexed is the first "real update" to HSSP. It now really uses the additional 64 bytes of the header and is more complex than the versions before. Make sure to decrypt the file before decompressing it. + #### 2.4.1. New features - Indexing @@ -226,27 +228,25 @@ When encrypting, you have to encrypt the whole body. #### 2.4.3. File structure -HSSP Indexed is the first "real update" to HSSP. It now really uses the additional 64 bytes of the header and is more complex than the versions before. Make sure to decrypt the file before decompressing it. - ##### 2.4.3.1. Header -| Offset | Length | Description | Type | -| :----: | :----: | :------------------------------------------------------------------------------------------------- | :------: | -| 0x0 | 0x4 | Magic value: `HSSP` | UTF-8 | -| 0x4 | 0x1 | File standard version (0x4) | Uint8 | -| 0x5 | 0x3 | Unused. You can put anything here. | | -| 0x8 | 0x4 | Number of contained files | Uint32LE | -| 0xC | 0x20 | Password hash (double SHA-256) | | -| 0x2C | 0x10 | Initialization vector (IV) | | -| 0x3C | 0x4 | Used [compression algorithm](#3-compression-algorithms) | UTF-8 | -| 0x40 | 0x4 | Checksum of the [body](#2433-body) (files) | Uint32LE | -| 0x44 | 0x8 | File count of all the files, even those that are not in this package! (may be 0x0 if not splitted) | Uint64LE | -| 0x4C | 0x8 | Offset of the file that has been splitted. (0x0 if not splitted) | Uint64LE | -| 0x54 | 0x4 | Checksum of the previous package (0x0 if not splitted or not existing) | Uint32LE | -| 0x58 | 0x4 | Checksum of the next package (0x0 if not splitted or not existing) | Uint32LE | -| 0x5C | 0x4 | ID of this package (0x0 if not splitted) (0 is the first part, 1 is the second, ...) | Uint32LE | -| 0x60 | 0x10 | Comment | UTF-8 | -| 0x70 | 0x10 | Generator credits, the official JavaScript library puts `hssp 5.0.0 @ npm` in here. | UTF-8 | +| Offset | Length | Description | Type | +| :----: | :----: | :------------------------------------------------------------------------------------------------------------------------ | :------: | +| 0x0 | 0x4 | Magic value: `HSSP` | UTF-8 | +| 0x4 | 0x1 | File standard version (0x4) | Uint8 | +| 0x5 | 0x3 | Unused. You can put anything here. | | +| 0x8 | 0x4 | Number of contained files | Uint32LE | +| 0xC | 0x20 | Password hash (double SHA-256) | | +| 0x2C | 0x10 | Initialization vector (IV) | | +| 0x3C | 0x4 | Used [compression algorithm](#3-compression-algorithms) | UTF-8 | +| 0x40 | 0x4 | Checksum of the [body](#2433-body) (files) | Uint32LE | +| 0x44 | 0x8 | File count of all the files, even those that are not in this package! (may be 0x0 if not splitted) | Uint64LE | +| 0x4C | 0x8 | Offset of the file that has been splitted. (0x0 if not splitted) | Uint64LE | +| 0x54 | 0x4 | Checksum of the previous package (0x0 if not splitted or not existing) | Uint32LE | +| 0x58 | 0x4 | Checksum of the next package (0x0 if not splitted or not existing) | Uint32LE | +| 0x5C | 0x4 | ID of this package (0x0 if not splitted) (0 is the first part, 1 is the second, ...) | Uint32LE | +| 0x60 | 0x10 | Comment | UTF-8 | +| 0x70 | 0x10 | Generator credits, the official JavaScript library puts `hssp 5.0.0 @ npm` in here. Acridotheres uses `acridotheres.com`. | UTF-8 | ##### 2.4.3.2. Index @@ -281,6 +281,102 @@ A file is structured like this: | :----: | :----: | :------------ | :--: | | 0x0 | ? | File contents | | +### 2.5. HSSP v5 (Flagged/FLGD) + +| Release date | +| :----------: | +| 2023-08-24 | + +HSSP Flagged is a small, but important update to HSSP Indexed. It adds flags to determine if compression, encryption, splitting, etc. is used, which makes HSSP more robust because "hash equal to zero" bugs cannot happen anymore. + +"Hash equal to zero" bugs happend when a parser thought that the file is not encrypted, because the password hash was equal to zero. This is not possible anymore, because the parser can now check securely if the file is encrypted. + +#### 2.5.1. New features + +- Flags + +#### 2.5.2. File structure + +##### 2.5.2.1. Header + +| Offset | Length | Description | Type | +| :----: | :----: | :------------------------------------------------------------------------------------------------------------------------ | :------: | +| 0x0 | 0x4 | Magic value: `HSSP` | UTF-8 | +| 0x4 | 0x1 | File standard version (0x4) | Uint8 | +| 0x5 | 0x3 | [Flags](#2522-flags) | | +| 0x8 | 0x4 | Number of contained files | Uint32LE | +| 0xC | 0x20 | Password hash (double SHA-256) | | +| 0x2C | 0x10 | Initialization vector (IV) | | +| 0x3C | 0x4 | Used [compression algorithm](#3-compression-algorithms) | UTF-8 | +| 0x40 | 0x4 | Checksum of the [body](#2524-body) (files) | Uint32LE | +| 0x44 | 0x8 | File count of all the files, even those that are not in this package! (may be 0x0 if not splitted) | Uint64LE | +| 0x4C | 0x8 | Offset of the file that has been splitted. (0x0 if not splitted) | Uint64LE | +| 0x54 | 0x4 | Checksum of the previous package (0x0 if not splitted or not existing) | Uint32LE | +| 0x58 | 0x4 | Checksum of the next package (0x0 if not splitted or not existing) | Uint32LE | +| 0x5C | 0x4 | ID of this package (0x0 if not splitted) (0 is the first part, 1 is the second, ...) | Uint32LE | +| 0x60 | 0x10 | Comment | UTF-8 | +| 0x70 | 0x10 | Generator credits, the official JavaScript library puts `hssp 5.0.0 @ npm` in here. Acridotheres uses `acridotheres.com`. | UTF-8 | + +##### 2.5.2.2. Flags + +| Bit | Name | Description | +| :-: | :------------------------------- | :----------------------------------------------------------------- | +| 0 | Is encrypted | If this bit is set, the file is encrypted. | +| 1 | Is compressed | If this bit is set, the file is compressed. | +| 2 | Is splitted | If this bit is set, the file is splitted. | +| 4 | Continues previous split package | If this bit is set, the file continues the previous split package. | +| 5 | Continues next split package | If this bit is set, the file continues the next split package. | +| 7 | F8 | Unused. | +| 8 | F9 | Unused. | +| 9 | F10 | Unused. | +| 10 | F11 | Unused. | +| 11 | F12 | Unused. | +| 12 | F13 | Unused. | +| 13 | F14 | Unused. | +| 14 | F15 | Unused. | +| 15 | F16 | Unused. | +| 16 | F17 | Unused. | +| 17 | F18 | Unused. | +| 18 | F19 | Unused. | +| 19 | F20 | Unused. | +| 20 | F21 | Unused. | +| 21 | F22 | Unused. | +| 22 | F23 | Unused. | +| 23 | F24 | Unused. | + +##### 2.5.2.3. Index + +The index is structured like this: + +| Offset | Length | Description | Type | +| :----------------------: | :---------: | :---------------------------------------------------------------------------------------------------------------- | :------: | +| 0x0 | 0x8 | File length in Bytes | Uint64LE | +| 0x8 | 0x2 | Name length in Bytes (= NL) | Uint16LE | +| 0xA | NL | Name of the file | UTF-8 | +| 0xA+NL | 0x2 | Owner length in Bytes (= OL) | Uint16LE | +| 0xC+NL | OL | Owner of the file | UTF-8 | +| 0xC+NL+OL | 0x2 | Owner group length in Bytes (= GL) | Uint16LE | +| 0xE+NL+OL | GL | Owner group of the file | UTF-8 | +| 0xE+NL+OL+GL | 0x4 | Web link length in Bytes (= WL) | Uint32LE | +| 0x12+NL+OL+GL | WL | Web link of the file | UTF-8 | +| 0x12+NL+OL+GL+WL | 0x6 | File creation time as Unix timestamp (ms) | Uint48LE | +| 0x18+NL+OL+GL+WL | 0x6 | File modification time as Unix timestamp (ms) | Uint48LE | +| 0x1E+NL+OL+GL+WL | 0x6 | File access time as Unix timestamp (ms) | Uint48LE | +| 0x24+NL+OL+GL+WL | 0x1 + 1 bit | File permissions (chmod format) | binary | +| 0x25+NL+OL+GL+WL + 1 bit | 7 bit | File attributes (is folder, is hidden, is system file, enable backup, require backup, is read-only, is main file) | binary | + +Repeat this for every file. + +##### 2.5.2.4. Body + +The body consists of multiple files. + +A file is structured like this: + +| Offset | Length | Description | Type | +| :----: | :----: | :------------ | :--: | +| 0x0 | ? | File contents | | + ## 3. Compression algorithms | Name | IDXD code |