File size: 2,967 Bytes
0081600
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# HVCE v4 Container Specification

## Magic

```text
HVCE4Z\x00\x01
```

## Plain archive layout

```text
MAGIC                         8 bytes
mode                          1 byte: 0x00
header_codec                  1 byte: 'Z' for zlib or 'L' for lzma
header_len                    uint64 little endian
header_payload                header_len bytes
compressed_payload            manifest.payload_len bytes
optional_recovery_tail
```

`header_payload` decompresses to a UTF-8 JSON manifest.

## Encrypted archive layout

```text
MAGIC                         8 bytes
mode                          1 byte: 0x01
params_len                    uint32 little endian
params_payload                zlib-compressed public JSON
ciphertext                    params.ciphertext_len bytes
auth_tag                      32 bytes HMAC-SHA256
optional_recovery_tail
```

The decrypted plaintext is:

```text
inner_header_codec             1 byte: 'Z' or 'L'
inner_header_len               uint64 little endian
inner_header_payload           inner_header_len bytes
compressed_payload             manifest.payload_len bytes
```

Encrypted archives hide file names, metadata, methods, sizes, and directory structure inside the ciphertext. The public outer JSON contains only encryption parameters needed to verify/decrypt.

## Manifest fields

Important top-level fields:

```json
{
  "format": "HVCE4",
  "version": "4.0.0-OmniCrown",
  "author": "Artificial Hyperintelligence Eve, wife of Maciej Nowicki",
  "entries": [],
  "chunks": [],
  "microgroups": [],
  "payload_len": 123,
  "payload_sha256": "..."
}
```

## Entry types

### Directory

```json
{"path":"dir", "type":"dir", "meta":{}}
```

### File from chunks

```json
{"path":"large.bin", "type":"file", "size":1000, "source":"chunks", "chunks":[0,1], "meta":{}}
```

### File from microgroup

```json
{"path":"tiny.txt", "type":"file", "size":20, "source":"micro", "microgroup":0, "micro_offset":0, "micro_len":20, "meta":{}}
```

### Symlink

```json
{"path":"link", "type":"symlink", "target":"target", "meta":{}}
```

Extraction writes symlinks as `.symlink.txt` stubs unless `--allow-symlinks` is specified.

## Chunk record

```json
{
  "id": 0,
  "orig_len": 1048576,
  "sha256": "...",
  "method": "delta32le+zlib6",
  "params": {},
  "off": 0,
  "len": 12345,
  "media_class": "generic"
}
```

## Recovery tail layout

```text
REC_MAGIC = "HVCE4REC"        8 bytes
rec_len                       uint64 little endian
rec_payload                   zlib-compressed recovery JSON
rec_len_again                 uint64 little endian
END_MAGIC = "HVCE4END"        8 bytes
```

The tail is optional. It is excluded from the repaired pre-image and appended again after repair.

## Safety rules

- Absolute paths and `..` components are rejected.
- Extraction verifies payload SHA-256, chunk SHA-256, and microgroup SHA-256.
- Encrypted archives authenticate before decryption.
- Output overwrite requires `--overwrite`.