{
  "slug": "scryptenc-file",
  "name": "gizza-ai/scryptenc-file",
  "version": "0.1.0",
  "title": "scrypt file encrypt & decrypt — scryptenc container tool — gizza.ai",
  "description": "Encrypt, decrypt and inspect files in the scrypt encrypted data format the scrypt CLI reads, with tunable logN, r and p cost parameters.",
  "tags": [
    "scrypt",
    "scrypt enc",
    "encrypt file",
    "decrypt file",
    "scryptenc",
    "aes-256-ctr",
    "hmac-sha256",
    "kdf"
  ],
  "category": "documents",
  "urls": {
    "page": "https://gizza.ai/tools/scryptenc-file/",
    "markdown": "https://gizza.ai/tools/scryptenc-file/index.md",
    "descriptor": "https://gizza.ai/tools/scryptenc-file/tool.json",
    "deep_link_example": "https://gizza.ai/tools/scryptenc-file/?data=attack%20at%20dawn&password=correct%20horse%20battery%20staple&operation=encrypt&data_encoding=text&output_encoding=base64&log_n=14&r=8&p=1&salt=000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f&max_memory_mib=32"
  },
  "cli": "gizza tool scryptenc-file \"attack at dawn\" 'password=correct horse battery staple'",
  "tool": {
    "description": "Read and write the scrypt encrypted data format used by the scrypt CLI (scrypt enc / scrypt dec) and compatible tools like rscrypt: a 96-byte header carrying the magic, version, logN/r/p cost parameters, 32-byte salt, SHA-256 checksum and header HMAC, followed by AES-256-CTR ciphertext and a trailing HMAC-SHA256 over the whole file. Set operation=encrypt to seal text or bytes with a passphrase, operation=decrypt to verify both HMACs and recover the plaintext, or operation=info to report a container's cost parameters, salt and sizes without any passphrase.",
    "parameters": {
      "additionalProperties": false,
      "properties": {
        "data": {
          "description": "What to process: the plaintext to seal when operation=encrypt, or the scrypt container to open or inspect when operation=decrypt or info. Read according to data_encoding. Capped at 4 MiB of decoded bytes.",
          "type": "string"
        },
        "data_encoding": {
          "default": "text",
          "description": "How to read data. text (default) treats it as UTF-8 characters when encrypting and auto-detects hex vs base64 when decrypting or inspecting; hex and base64 decode it to raw bytes first, which is how you seal binary input. Whitespace and a leading 0x are ignored in hex.",
          "enum": [
            "text",
            "hex",
            "base64"
          ],
          "type": "string"
        },
        "log_n": {
          "default": 14,
          "description": "log2 of the scrypt CPU/memory cost N, so N = 2^log_n. Default 14 (N=16384, about 16 MiB with r=8), chosen to fit the sandbox. Each +1 doubles both work and memory. Used only when operation=encrypt — decrypt and info read it from the file's own header.",
          "maximum": 63,
          "minimum": 1,
          "type": "integer"
        },
        "max_memory_mib": {
          "default": 32,
          "description": "Ceiling in MiB on the scrypt working buffer, the analogue of the reference CLI's -M maxmem. Default 32; the hard maximum is 64 because this runs in a 64 MiB wasm sandbox. Parameters needing more are refused with the required amount named, rather than trapping. Applies to both encrypt and decrypt.",
          "maximum": 64,
          "minimum": 1,
          "type": "integer"
        },
        "operation": {
          "default": "encrypt",
          "description": "encrypt (default) seals data into a new scrypt-format container; decrypt verifies both HMACs of an existing container and returns the plaintext; info reads the header's cost parameters and sizes WITHOUT a password, which also works on files whose parameters are too large to open here.",
          "enum": [
            "encrypt",
            "decrypt",
            "info"
          ],
          "type": "string"
        },
        "output_encoding": {
          "default": "base64",
          "description": "How binary results are printed. base64 (default) is the compact form to paste between systems; hex is byte-addressable for comparing against the format spec. On decrypt this applies only when the plaintext is not valid UTF-8 — readable text comes back as text. Ignored by info.",
          "enum": [
            "base64",
            "hex"
          ],
          "type": "string"
        },
        "p": {
          "default": 1,
          "description": "scrypt parallelization p, default 1. Raises CPU work without raising the large memory buffer, so it hardens against attackers with lots of memory but little parallel compute. Used only when operation=encrypt.",
          "maximum": 16,
          "minimum": 1,
          "type": "integer"
        },
        "password": {
          "description": "The passphrase the AES-256 and HMAC-SHA256 keys are derived from via scrypt. Required for encrypt and decrypt; ignored by info. Any non-empty string, including non-ASCII; it is UTF-8 encoded before derivation. The same passphrase plus the file's own logN/r/p and salt are all that is needed to decrypt, and there is no recovery path if it is lost.",
          "type": "string"
        },
        "r": {
          "default": 8,
          "description": "scrypt block size r, default 8 (the value the reference scrypt CLI uses). Memory scales as 128 * N * r, so raising r raises memory as much as raising log_n does. Used only when operation=encrypt.",
          "maximum": 32,
          "minimum": 1,
          "type": "integer"
        },
        "salt": {
          "description": "Optional 32-byte salt as 64 hex characters (e.g. 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f). Leave empty for a fresh random salt, which is what you want for real data; set it only to reproduce a container byte for byte in a test. Ignored when operation=decrypt or info (the salt is read from the header).",
          "type": "string"
        }
      },
      "required": [
        "data",
        "password"
      ],
      "type": "object"
    }
  }
}