Skip to main content
Glama

CipherHUB Cryptography Toolkit

ctr_cipher

Read-only

[symmetric_cipher] CTR 计数器模式加解密(AES-256-CTR / SM4-CTR)。CTR 是把块密码转成密钥流的模式:加解密为同一操作(密钥流 XOR),无填充,密文长度与明文等长,任意长度输入(1B ~ 16MB)。algorithm 可选 AES256CTR(key 32B,cryptography 实现)或 SM4CTR(key 16B,GmSSL C 库实现,与 eet 的 sm4-ctr 同源)。iv_in_hex 为 16 字节初始计数器块(32 hex 字符),同 key/iv 下加解密互为逆操作。注意:CTR 不提供认证(无 MAC/tag)——需要防篡改时优先用 stream_cipher 的 AEAD 模式(AES-GCM/ChaCha20-Poly1305/SM4-GCM),CTR 仅适合已有独立认证层或互操作对数场景。返回字段:output_data_in_hex、output_length、output_sha256、algorithm。

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "ctr_cipher"
  }
}

Input Schema

NameRequiredDescriptionDefault
algorithmNo密码算法名称(具体可选值因工具而异,见工具描述)AES256CTR
iv_in_hexNo初始向量的十六进制字符串,固定 32 个 hex 字符(16 字节)
key_in_hexNo密钥的十六进制字符串。长度取决于算法:AES256=64 字符(32B),AES128/SM4=32 字符(16B)
input_data_in_hexNo输入数据的十六进制字符串(加密时为明文,解密时为密文,1B~16MB)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the readOnlyHint/openWorldHint annotations, it discloses padding behavior (none), the ciphertext-length-equals-plaintext invariant, the accepted input range (1B–16MB), the inverse-operation property under identical key/IV, and the implementation provenance (cryptography vs GmSSL C library, same origin as eet's sm4-ctr). It even lists the return fields despite there being no output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the algorithm tag and core mechanism, then security caveat, then return fields — a sensible ordering with no filler sentences. It is dense and somewhat long for a single tool, with mixed-language bracketed labels adding minor visual noise, but each clause carries information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a stateless symmetric primitive with no output schema, the definition covers everything an agent needs: algorithm choice, key/IV sizing, input limits, non-authenticated nature with a concrete safer alternative, and the exact returned fields. No material gap remains.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description still adds meaning: it clarifies that iv_in_hex is specifically the 16-byte initial *counter* block (implying counter increment semantics), pins key sizes per algorithm (32B for AES256CTR, 16B for SM4CTR), and reiterates the key/IV pairing requirement for invertibility.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource pair: CTR-mode encrypt/decrypt with two named algorithms (AES-256-CTR / SM4-CTR). It immediately explains the mechanism (block cipher turned into a keystream, encryption and decryption are the same XOR operation), which distinguishes it from siblings like block_cipher and stream_cipher without needing their schemas.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit when-not: CTR provides no authentication (no MAC/tag), and directs the agent to stream_cipher's AEAD modes (AES-GCM/ChaCha20-Poly1305/SM4-GCM) when tamper resistance is needed. It also names the legitimate conditions for using CTR — an existing independent auth layer or protocol interoperability.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.