| language: [fa] | |
| license: other | |
| multilingual: false | |
| pretty_name: encrypted_legal_dataset | |
| task_categories: [other] | |
| task_ids: [] | |
| source_datasets: [] | |
| # ara_v4 | |
| **ara_v4** is a dataset where the `text` column has been encrypted with **AES-GCM (AES-256)** | |
| to preserve privacy while still allowing distribution. | |
| ## Dataset Description | |
| - **Columns**: | |
| - `score`: floating-point metadata value | |
| - `text`: Base64-encoded string containing AES-GCM encrypted text | |
| - **Encryption**: | |
| - AES-256 in GCM mode | |
| ## Usage | |
| You can load the dataset using the ๐ค Datasets library: | |
| ```python | |
| import base64 | |
| from cryptography.hazmat.primitives.ciphers.aead import AESGCM | |
| from datasets import load_dataset | |
| # ๐ Replace this with the Base64 key provided securely | |
| key_b64 = "PASTE-YOUR-KEY-HERE" | |
| key = base64.b64decode(key_b64) | |
| aesgcm = AESGCM(key) | |
| def decrypt(token: str) -> str: | |
| data = base64.b64decode(token.encode()) | |
| nonce, ciphertext = data[:12], data[12:] | |
| return aesgcm.decrypt(nonce, ciphertext, None).decode() | |
| # Load dataset | |
| dataset = load_dataset("QomSSLab/ara_v4") | |
| # Decrypt rows | |
| dataset = dataset.map(lambda x: {"text": decrypt(x["text"])}) | |
| ``` | |