File size: 4,646 Bytes
691fc0b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# BCV3 Decryption Guide

## Overview
The BCV3 dataset includes encrypted question-answer pairs to protect intellectual property while allowing community review. This guide explains how to decrypt them.

## Encryption Details
- **Algorithm**: AES-256-GCM (Galois/Counter Mode)
- **Key Derivation**: SHA-256 hash of the passphrase
- **IV Format**: 16-byte random initialization vector (base64-encoded)
- **Authentication**: 16-byte GCM tag for integrity verification

## Key
Use the following passphrase to derive the AES-256-GCM key:

```
A_Visual_Vertical_Verifiable_Benchmark_for_Multimodal_Browsing_Agents
```

## Data Format

The dataset uses **one canonical format: `train.jsonl`** (optimized and deduplicated):

```json
{
  "id": "...",
  "category": "...",
  "sub_category": "...",
  "image": "...",
  "image_paths": "[...JSON string...]",
  "encrypted_question": "{...JSON string...}",
  "encrypted_answer": "{...JSON string...}",
  "metadata": "{...JSON string (includes trajectory)...}",
  "sub_goals": "[...JSON string...]"
}
```

**Key optimizations:**
-**No redundant trajectory**: trajectory is inside `metadata`, not duplicated at top level
-**JSON strings**: All fields are serialized as JSON for HuggingFace Dataset Viewer compatibility
-**Space savings**: 28.1% reduction from original (2.0 MB → 1.44 MB)

**Legacy format:** The original `bcv3_encrypted.jsonl` (with redundant top-level trajectory) is archived in `/archive/` for reference only.

## Requirements
```bash
pip install cryptography
```

## Usage

### 1. Decrypt the whole dataset to a single JSON file

```bash
python scripts/decryption_script.py \
  --input data/train.jsonl \
  --key "A_Visual_Vertical_Verifiable_Benchmark_for_Multimodal_Browsing_Agents" \
  --output decrypted_bcv3.json
```

**Options:**
- `--keep-encrypted`: Keep encrypted fields in output (default: remove them)

**Example output:**
```json
[
  {
    "id": "001_Culture_Art_L3_p2_t2_m0_r2_w0_c0_g5",
    "question": "The content in Figure 1 is a classic of a certain religion...",
    "answer": "2",
    "metadata": {...},
    ...
  }
]
```

### 2. Batch decrypt to per-sample JSON files

```bash
# Create a key file
echo "A_Visual_Vertical_Verifiable_Benchmark_for_Multimodal_Browsing_Agents" > key.txt

# Run batch decryption
python scripts/decrypt_batch.py \
  --input data/train.jsonl \
  --key-file key.txt \
  --output-dir decrypted_samples/
```

**Options:**
- `--keep-encrypted`: Keep encrypted fields in output (default: remove them)

**Output structure:**
```
decrypted_samples/
├── 001_Culture_Art_L3_p2_t2_m0_r2_w0_c0_g5.json
├── 002_Culture_Art_...json
└── ...
```

### 3. Using archived legacy format (optional)

If you need to work with the archived original format:

```bash
# Scripts support legacy bcv3_encrypted.jsonl (archived in /archive/)
python scripts/decryption_script.py \
  --input ../archive/bcv3_encrypted.jsonl \
  --key "A_Visual_Vertical_Verifiable_Benchmark_for_Multimodal_Browsing_Agents" \
  --output decrypted_legacy.json
```

The scripts automatically detect and handle both formats.

## Python API

```python
from encryption_utils import derive_key, decrypt_text

key_str = "A_Visual_Vertical_Verifiable_Benchmark_for_Multimodal_Browsing_Agents"
key = derive_key(key_str)

# Decrypt a single encrypted field (dict with iv/ciphertext/tag)
encrypted_dict = {
    "iv": "...",
    "ciphertext": "...",
    "tag": "..."
}
plaintext = decrypt_text(encrypted_dict, key)
```

## Verification

Test decryption with a small sample:

```bash
head -1 data/train.jsonl | python3 << 'EOF'
import sys
import json
sys.path.insert(0, 'scripts')
from encryption_utils import derive_key, decrypt_text

key = derive_key("A_Visual_Vertical_Verifiable_Benchmark_for_Multimodal_Browsing_Agents")
obj = json.loads(sys.stdin.read())
enc_q = json.loads(obj['encrypted_question'])
enc_a = json.loads(obj['encrypted_answer'])
print("Question:", decrypt_text(enc_q, key)[:80])
print("Answer:", decrypt_text(enc_a, key))
EOF
```

## Troubleshooting

### "Decryption failed" or integrity error
- Verify you're using the exact passphrase (case-sensitive)
- Ensure the encrypted data has valid iv/ciphertext/tag fields

### "Unrecognized format" warning
- The script will skip records that don't have encrypted fields
- Check that your input file is in the expected format

### File not found
- Ensure paths are relative to the script directory or use absolute paths
- For batch mode, the key file must exist and be readable

## Questions?
For issues or questions about decryption, please refer to the main README or file an issue on the repository.