FixedHash: Difference between revisions
Jump to navigation
Jump to search
imported>Leoetlino (Created page with "{{File format|name=FixedHash|version=1|endianness=little}} '''FixedHash''' is a custom Grezzo format for serializing wikipedia:hash tables that map string keys to arbitra...") |
imported>Leoetlino (→Format: alignment) |
||
Line 35: | Line 35: | ||
| X + 8 || Entry[...] || '''Entries''' | | X + 8 || Entry[...] || '''Entries''' | ||
|- | |- | ||
| Y = X + entries section size || u64 || Entry offsets section size | | Y = align(X + entries section size, 8) || u64 || Entry offsets section size | ||
|- | |- | ||
| Y + 8 || u32[...] || '''Entry offsets''' (relative to the Entries section) | | Y + 8 || u32[...] || '''Entry offsets''' (relative to the Entries section) | ||
|- | |- | ||
| Z = Y + entry offset section size || u64 || Data section size | | Z = align(Y + entry offset section size, 8) || u64 || Data section size | ||
|- | |- | ||
| Z + 8 || any || '''Data''' | | Z + 8 || any || '''Data''' | ||
|- | |- | ||
| A = Z + data section size || u32 || Name section size | | A = align(Z + data section size, 4) || u32 || Name section size | ||
|- | |- | ||
| A + 4 || C strings || '''Names''' | | A + 4 || C strings || '''Names''' |
Revision as of 20:42, 16 April 2020
File format | |
---|---|
Endianness | little |
Version | 1 |
This article is about the file format in general. For actual values, check the game RomFS. |
FixedHash is a custom Grezzo format for serializing hash tables that map string keys to arbitrary binary blobs.
Hash function
String keys are hashed using the following hash function:
u32 Hash(const char* key) {
u32 hash = 0;
while (*key) {
hash ^= *key++ + (h >> 2) + (h << 5);
}
return hash;
}
Format
Offset | Type | Description |
---|---|---|
0x0 | u8 | Magic (must be 0x3D) |
0x1 | u8 | Version (must be 1) |
0x2 | u16 | Number of hash table buckets (N) |
0x4 | u16 | Number of child FixedHash nodes |
0x6 | u16 | Padding? [check] |
0x8 | u32[N + 1] | Offsets to the first entry in each bucket (relative to the Entries section) |
X = (0x8 + 4*(N+1) + 3) & -8 | u64 | Entries section size |
X + 8 | Entry[...] | Entries |
Y = align(X + entries section size, 8) | u64 | Entry offsets section size |
Y + 8 | u32[...] | Entry offsets (relative to the Entries section) |
Z = align(Y + entry offset section size, 8) | u64 | Data section size |
Z + 8 | any | Data |
A = align(Z + data section size, 4) | u32 | Name section size |
A + 4 | C strings | Names |