Update MMSearch-Plus dataset with encrypted text fields (images unchanged)
Browse files- README.md +2 -2
- mmsearch_plus.py +5 -20
README.md
CHANGED
|
@@ -69,7 +69,7 @@ Official repository for the paper "[MMSearch-Plus: Benchmarking Provenance-Aware
|
|
| 69 |
|
| 70 |
## Usage
|
| 71 |
|
| 72 |
-
**⚠️ Important:
|
| 73 |
|
| 74 |
### Dataset Usage
|
| 75 |
|
|
@@ -79,7 +79,7 @@ Load the dataset with automatic decryption using your canary string:
|
|
| 79 |
import os
|
| 80 |
from datasets import load_dataset
|
| 81 |
|
| 82 |
-
# Set the canary string (hint: it's the name of this repo)
|
| 83 |
os.environ['MMSEARCH_PLUS'] = 'your_canary_string'
|
| 84 |
|
| 85 |
# Load dataset with transparent decryption
|
|
|
|
| 69 |
|
| 70 |
## Usage
|
| 71 |
|
| 72 |
+
**⚠️ Important: Text fields in this dataset are encrypted to prevent data contamination. Images are NOT encrypted and remain accessible. Decryption of text is handled transparently by the dataset loader.**
|
| 73 |
|
| 74 |
### Dataset Usage
|
| 75 |
|
|
|
|
| 79 |
import os
|
| 80 |
from datasets import load_dataset
|
| 81 |
|
| 82 |
+
# Set the canary string (hint: it's the name of this repo without username)
|
| 83 |
os.environ['MMSEARCH_PLUS'] = 'your_canary_string'
|
| 84 |
|
| 85 |
# Load dataset with transparent decryption
|
mmsearch_plus.py
CHANGED
|
@@ -1,12 +1,14 @@
|
|
| 1 |
-
"""MMSearch-Plus dataset with transparent decryption.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
import base64
|
| 4 |
import hashlib
|
| 5 |
-
import io
|
| 6 |
import os
|
| 7 |
from typing import Dict, Any, List
|
| 8 |
import datasets
|
| 9 |
-
from PIL import Image
|
| 10 |
|
| 11 |
_CITATION = """\
|
| 12 |
@article{tao2025mmsearch,
|
|
@@ -41,23 +43,6 @@ def derive_key(password: str, length: int) -> bytes:
|
|
| 41 |
key = hasher.digest()
|
| 42 |
return key * (length // len(key)) + key[: length % len(key)]
|
| 43 |
|
| 44 |
-
def decrypt_image(ciphertext_b64: str, password: str) -> Image.Image:
|
| 45 |
-
"""Decrypt base64-encoded encrypted image bytes back to PIL Image."""
|
| 46 |
-
if not ciphertext_b64:
|
| 47 |
-
return None
|
| 48 |
-
|
| 49 |
-
try:
|
| 50 |
-
encrypted = base64.b64decode(ciphertext_b64)
|
| 51 |
-
key = derive_key(password, len(encrypted))
|
| 52 |
-
decrypted = bytes([a ^ b for a, b in zip(encrypted, key)])
|
| 53 |
-
|
| 54 |
-
# Convert bytes back to PIL Image
|
| 55 |
-
img_buffer = io.BytesIO(decrypted)
|
| 56 |
-
image = Image.open(img_buffer)
|
| 57 |
-
return image
|
| 58 |
-
except Exception:
|
| 59 |
-
return None
|
| 60 |
-
|
| 61 |
def decrypt_text(ciphertext_b64: str, password: str) -> str:
|
| 62 |
"""Decrypt base64-encoded ciphertext using XOR cipher with derived key."""
|
| 63 |
if not ciphertext_b64:
|
|
|
|
| 1 |
+
"""MMSearch-Plus dataset with transparent decryption.
|
| 2 |
+
|
| 3 |
+
Note: Only text fields (question, answer, video_url, arxiv_id) are encrypted.
|
| 4 |
+
Images are NOT encrypted and remain as PIL Image objects for accessibility.
|
| 5 |
+
"""
|
| 6 |
|
| 7 |
import base64
|
| 8 |
import hashlib
|
|
|
|
| 9 |
import os
|
| 10 |
from typing import Dict, Any, List
|
| 11 |
import datasets
|
|
|
|
| 12 |
|
| 13 |
_CITATION = """\
|
| 14 |
@article{tao2025mmsearch,
|
|
|
|
| 43 |
key = hasher.digest()
|
| 44 |
return key * (length // len(key)) + key[: length % len(key)]
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
def decrypt_text(ciphertext_b64: str, password: str) -> str:
|
| 47 |
"""Decrypt base64-encoded ciphertext using XOR cipher with derived key."""
|
| 48 |
if not ciphertext_b64:
|