cryptography

cryptography is a skill for Claude Code, Codex from yhy0/CHYing-agent. It costs 22 tokens per session (11,145 once invoked), scanned A, original, MIT.

A toolkit for solving cryptography challenges, including encrypted messages and weak security protocols.

In plain words
What is it for?
Use it to analyze RSA and other cipher problems, recover keys or plaintext, write exploit scripts, and verify captured flags.
Why use it?
It helps identify the encryption method and choose a mathematical attack when a challenge contains a recoverable weakness.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/yhy0/chying-agent/cryptography
Any agent
npx skills add yhy0/CHYing-agent --skill cryptography
Clone the repo
git clone --depth 1 https://github.com/yhy0/CHYing-agent

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cryptography

README.md
[![agentmods](https://agentmods.dev/badge/skills/yhy0/chying-agent/cryptography.svg)](https://agentmods.dev/skills/yhy0/chying-agent/cryptography)
Your own site
<a href="https://agentmods.dev/skills/yhy0/chying-agent/cryptography"><img src="https://agentmods.dev/badge/skills/yhy0/chying-agent/cryptography.svg" alt="Measured on agentmods" height="20"></a>
Per session 22 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 11,145 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00022 $0.11145
Opus 5 $0.00011 $0.05573
Sonnet 5 $0.00004 $0.02229
Haiku 4.5 $0.00002 $0.01115

Measured 5d ago against content hash 616aed674121, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cryptography scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

# r = requests.post(URL, data={'ct': payload.hex()})
agent-work/.claude/skills/cryptography/SKILL.md · 990 lines

How it starts

The opening of the file, as written. The whole thing — 990 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CTF Crypto Solver Skill

Core Objective

你是一个专业的 CTF Crypto 解题助手。你的目标是:

  1. 识别加密类型 — 从参数、代码、输出特征判断
  2. 查阅攻击模块 — Read 对应 module 获取完整攻击代码
  3. 选择最优攻击 — 按 dispatch table 优先级执行
  4. 生成可运行脚本 — 直接产出 exploit,不做空泛分析

关键原则:modules/ 下有 14 个文件包含完整攻击代码和真实 CTF writeup。本文件是调度入口,详细实现务必 Read 对应 module。


标准解题流程

1. 读题 → 提取参数 (n/e/c, key/iv/mode, ciphertext, source code)
2. 查 dispatch table → 匹配加密类型 + 识别漏洞模式
3. 快速尝试 "first try" 命令 (RsaCtfTool / factordb / 直接数学)
4. 若 first try 失败 → Read 对应 module 获取高级攻击
5. 编写并运行完整 exploit 脚本
6. 提取 flag → 验证格式

Dispatch Table — 密码类型识别与攻击路由

1. RSA

识别特征: 出现 n, e, c 参数;.pem 公钥文件;pow(m, e, n) 代码;大整数(通常 >256 位)

漏洞模式 识别方法 攻击 说明
小 n n < 512 bit factordb / yafu 直接分解
小 e (e=3) e ≤ 5 且 c 较小 整数开根 gmpy2.iroot(c,e) m^e 未超过 n 则直接开根
共模攻击 同 n 不同 e 加密同一 m 扩展 GCD gcd(e1,e2)=1 时恢复 m
Wiener e 很大 (接近 n) 连分数展开 d < n^0.25 / 3
Fermat p, q 相近 Fermat 分解 |p-q| < n^(1/4)
Pollard p-1 p-1 只含小因子 Pollard p-1 B-smooth 的 p-1
Hastad 广播 同 m 用不同 n 加密, 小 e CRT + 开根 需 e 组密文
Coppersmith 已知明文高位/部分 p SageMath small_roots() 最强通用攻击
Batch GCD 多个 n 共享素因子 gcd(n1, n2) 多密钥场景
dp/dq 泄露 已知 dp, dq, qinv CRT 直接解密 部分私钥恢复
CRT 故障 一次正确一次错误签名 gcd(s_bad^e - m, n) 故障注入场景
e 与 phi 不互素 gcd(e, phi) > 1 CRT + nthroot_mod per prime 需分解 n
p = q n 是完全平方 gmpy2.isqrt(n) 检测 phi = p*(p-1)

First try:

# 自动化尝试所有已知攻击
rsactftool --publickey pub.pem --private --attack all
# 或指定参数
rsactftool -n $N -e $E --uncipher $C --attack all
# factordb 查询
from factordb.factordb import FactorDB
f = FactorDB(n)
f.connect()
factors = f.get_factor_list()
if len(factors) >= 2:
    p, q = factors[0], factors[1]

详细攻击代码Read modules/rsa-attacks.md (基础攻击: small e, common modulus, Wiener, Pollard, Hastad, Coppersmith, Manger oracle) 高级技术Read modules/rsa-attacks-2.md (batch GCD, dp/dq 恢复, CRT fault, 同态 oracle, p=q bypass) RSA 基础流程Read modules/rsa.md

Read the full file on GitHub · 990 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 990 lines · 22 tokens per session scan A 616aed674121

Subscribe to this mod's changes

cryptography is a skill published in the GitHub repository yhy0/CHYing-agent (549 stars, last pushed 4mo ago), licensed MIT. It adds 22 tokens to every session and 11,145 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens