# Constant time testing

> Constant time testing is an open-source agent skill for security. Lets an agent measure timing side channels in running crypto code with dudect and Timecop. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/trailofbits/skills/tree/main/plugins/testing-handbook-skills/skills/constant-time-testing
- **Repository:** https://github.com/trailofbits/skills
- **GitHub stars:** 8,553
- **License:** CC-BY-SA-4.0
- **Skill name:** constant-time-testing
- **Collection:** https://github.com/trailofbits/skills
- **Categories:** [security](https://ai-powered.com/categories/security)
- **Listing updated:** 2026-11-30

## About

This skill guides the agent through testing whether a compiled cryptographic implementation leaks secrets through execution time. It explains the four families of constant-time tools (formal, symbolic, dynamic and statistical) and when each fits, then sets out a staged workflow: a quick statistical pass with dudect, followed by dynamic tracing with Timecop over Valgrind to locate the exact line of a leak if one appears.

The guidance also covers reading results, such as interpreting t-values from Welch's test, and remediation patterns like replacing secret-dependent branches, table lookups and variable-time division with constant-time alternatives. It recommends re-running tests across compilers, optimization levels and CPU architectures, and adding a dudect check to continuous integration.

The skill expects a C or similar compiled implementation with a harness that feeds fixed and random inputs, and the Valgrind and dudect tooling installed. It is a guide to running the tests rather than a static code review, which is handled by a separate constant-time analysis plugin.

## When your agent uses it

> Measures timing side channels in cryptographic implementations by running them, using dudect for statistical analysis and Timecop over Valgrind for dynamic tracing. Covers the formal, symbolic, dynamic, and statistical tool categories and how to read a result. Use when testing whether a running implementation is constant-time, measuring timing variance on a compiled binary, or investigating a suspected timing attack. Not for statically inspecting compiler output — the constant-time-analysis plugin covers that.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/trailofbits/skills/tree/HEAD/plugins/testing-handbook-skills/skills/constant-time-testing)
- [License: CC-BY-SA-4.0](https://github.com/trailofbits/skills/tree/HEAD/plugins/testing-handbook-skills/skills/constant-time-testing)

## Features

- **Tool category overview:** Compares formal, symbolic, dynamic and statistical approaches to finding timing leaks, with their trade-offs.
- **Statistical timing check:** Walks through a dudect harness comparing fixed and random input classes with Welch's t-test.
- **Dynamic secret tracing:** Shows how to mark secrets as poisoned and run under Valgrind to pinpoint the leaking line.
- **Common leak patterns:** Lists secret-dependent branches, table lookups, division and shifts that cause timing differences.
- **Remediation and re-verification:** Suggests constant-time rewrites and repeated testing across compilers and architectures.
- **CI integration guidance:** Describes running a timing test for a fixed duration in a build pipeline and failing on detected leaks.

## Good for

- Check whether my AES or RSA routine leaks timing information
- Set up a dudect harness for my crypto function
- Find which line of my C code branches on a secret key
- Review a compiled binary for timing variance before release
- Investigate a suspected timing attack on my signing code

## Install

### Claude Code

This skill ships in the `testing-handbook-skills` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add trailofbits/skills
/plugin install testing-handbook-skills@trailofbits
```

Or copy only this skill to `~/.claude/skills/constant-time-testing`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/trailofbits/skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/constant-time-testing &&
cp -R "$tmp/plugins/testing-handbook-skills/skills/constant-time-testing" ~/.claude/skills/constant-time-testing &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/constant-time-testing` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/constant-time-testing` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/trailofbits/skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/constant-time-testing &&
cp -R "$tmp/plugins/testing-handbook-skills/skills/constant-time-testing" ~/.agents/skills/constant-time-testing &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/constant-time-testing` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/constant-time-testing` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/trailofbits/skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/constant-time-testing &&
cp -R "$tmp/plugins/testing-handbook-skills/skills/constant-time-testing" ~/.cursor/skills/constant-time-testing &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/constant-time-testing` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/trailofbits/skills.git --path plugins/testing-handbook-skills/skills/constant-time-testing
```

Or copy the folder to `~/.gemini/skills/constant-time-testing` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/constant-time-testing`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/trailofbits/skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/constant-time-testing &&
cp -R "$tmp/plugins/testing-handbook-skills/skills/constant-time-testing" ~/.copilot/skills/constant-time-testing &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/constant-time-testing` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/trailofbits/skills.git
```

Then copy `skills/plugins/testing-handbook-skills/skills/constant-time-testing` into your agent's skills folder as `constant-time-testing`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When should Constant time testing trigger?

When testing whether a running implementation is constant-time, measuring timing variance on a compiled binary, or investigating a suspected timing attack.

### Does Constant time testing cover static inspection of compiler output?

No. Static inspection of compiler output is handled by the separate constant-time-analysis plugin.

### Which tools does Constant time testing rely on?

It centers on dudect for statistical analysis and Timecop over Valgrind for dynamic tracing, and points to other tools such as ct-verif and Binsec for formal and symbolic work.

### Can Constant time testing prove my code is free of timing leaks?

No. The guidance states that dudect gives statistical confidence only and cannot guarantee the absence of leaks.

### How do I install Constant time testing in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/constant-time-testing to use it in all your projects, or to .claude/skills/constant-time-testing in one project. Or install the testing-handbook-skills plugin, which includes it: /plugin marketplace add trailofbits/skills, then /plugin install testing-handbook-skills@trailofbits.

### Does Constant time testing run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Constant time testing?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Constant time testing?

The closest alternatives to Constant time testing are Constant time analysis, Audit integrity, Secret serialization, Red team and Agent security hardening.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Constant time analysis](https://ai-powered.com/skills/constant-time-analysis): Constant time analysis is an open-source agent skill for security.
- [Audit integrity](https://ai-powered.com/skills/audit-integrity): Audit integrity is an open-source agent skill for security.
- [Secret serialization](https://ai-powered.com/skills/secret-serialization): Secret serialization is an open-source agent skill for security.
- [Red team](https://ai-powered.com/skills/red-team): Red team is an open-source agent skill for security.
- [Agent security hardening](https://ai-powered.com/skills/agent-security-hardening): Agent security hardening is an open-source agent skill for security.
- [Audit context building](https://ai-powered.com/skills/audit-context-building): Audit context building is an open-source agent skill for security.
- [Fuzzing obstacles](https://ai-powered.com/skills/fuzzing-obstacles): Fuzzing obstacles is an open-source agent skill for security.
- [Wycheproof](https://ai-powered.com/skills/wycheproof): Wycheproof is an open-source agent skill for security.

---
Source: https://ai-powered.com/skills/constant-time-testing
