Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:EvolvingLMMs Lab Lmms eval MMSearch Plus Decrypt Utils

From Leeroopedia
Revision as of 12:31, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/EvolvingLMMs_Lab_Lmms_eval_MMSearch_Plus_Decrypt_Utils.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Location: /tmp/kapso_repo_sslb_59s/lmms_eval/tasks/mmsearch_plus/decrypt_utils.py

Principle: Task_Utility_Functions

Purpose

Decryption utilities for MMSearch-Plus dataset that protects sensitive data using XOR cipher with password-derived keys.

Key Functions

derive_key

def derive_key(password: str, length: int) -> bytes

Derives encryption key from password:

  • Uses SHA-256 hashing on password
  • Repeats/truncates hash to match desired length
  • Returns derived key bytes of specified length

Algorithm:

key = sha256(password)
result = key * (length // len(key)) + key[:length % len(key)]

decrypt_text

def decrypt_text(ciphertext_b64: str, password: str) -> str

Decrypts base64-encoded ciphertext:

  • Returns original if input empty
  • Decodes base64 to get encrypted bytes
  • Derives key matching ciphertext length
  • XOR decrypts: decrypted[i] = encrypted[i] ^ key[i]
  • Decodes result as UTF-8
  • Returns original on failure (logs warning)

decrypt_sample

def decrypt_sample(sample: Dict[str, Any], canary: str) -> Dict[str, Any]

Decrypts all encrypted fields in a dataset sample:

Encrypted Text Fields:

  • question
  • video_url
  • arxiv_id

Encrypted List Field:

  • answer (list of strings, each decrypted separately)

Unencrypted Fields:

  • Images (NOT encrypted)
  • category
  • difficulty
  • subtask

Returns decrypted copy of sample dictionary.

Implementation Details

  • XOR cipher with SHA-256 derived keys
  • Base64 encoding for encrypted data
  • Canary string serves as password (e.g., "MMSearch-Plus")
  • Graceful fallback: returns original text if decryption fails
  • Selective field encryption for privacy protection
  • List fields handled element-wise

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment