Continued with hash-based stacks:
[core.git] / contrib / file_stack / format.txt
1 A file-based stack:
2 ===================
3
4 This is the format for a file-based stack which works as any Stackable class.
5
6 General made up:
7
8 Purpose: | "magic"   | separator | count    | separator | position | separator |
9 ---------+-----------+-----------+----------+-----------+------0---+-----------+
10 Bytes:   | 9         | 1         | 20 (hex) | 1         | 20 (hex) | 1         |
11 ---------+-----------+-----------+----------+-----------+----------+-----------+
12 Example: | STACKv1.0 | 01        | 00...ff  | 02        | 00...ff  | 03        |
13
14 Continued:
15
16 Purpose: | hash 0 | separator | name 0 | entry 0    | hash n | separator | name n | entry n    | EOF |
17 ---------+--------+-----------+--------+------------+--------+-----------+--------+------------+-----+
18 Bytes:   |  64    | 1         | 10     | 1-n (pack) |  64    | 1         | 10     | 1-n (pack) | 1   |
19 ---------+--------+-----------+--------+------------+--------+-----------+--------+------------+-----+
20 Example: | abc    |    04     | foo    |    ...     | abc    |    04     | bar    |     ...    | EOF |
21
22 Explanations:
23 -------------
24  magic        - Identifies the file and version of format
25  separator    - Serves to detect end of strings with unknown/flexible length
26  count        - Total amount of entries (not deleted) encoded in hexa-decimal
27  position     - Seek position of current entry (which current() will give)
28  hash X       - Hash sum of entry X (SHA 256)
29  name X       - Name of stack the entries belongs in
30  entry X      - The actual data, compressed with pack()
31  EOF          - End-of-file character
32  ...          - Data
33  ???          - Must be still found out which character/hashing algorthym fits best