mvx-constant-time
Verify cryptographic operations execute in constant time to prevent timing attacks.
Skill by multiversx
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/multiversx-mvx-constant-time
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: security, finance
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/mvx-constant-time
What's inside
- Skill name
mvx-constant-time- Description
- Verify cryptographic operations execute in constant time to prevent timing attacks. Use when auditing custom crypto implementations, secret comparisons, or security-sensitive algorithms in smart contracts.
- License
- MIT
- Instructions
- 267 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Constant Time Analysis
Verify that cryptographic secrets are handled in constant time to prevent timing attacks. This skill is essential when reviewing any code that processes sensitive data where execution time could leak information.
## When to Use
- Auditing custom cryptographic implementations
- Reviewing secret comparison logic (hashes, signatures, keys)
- Analyzing authentication or verification code
- Checking password/PIN handling
- Reviewing any code where timing could leak secrets
## 1. Understanding Timing Attacks
### The Threat Model
An attacker measures how long operations take to infer secret values:
```
Comparison: secret[i] == input[i]
- If mismatch at i=0: ~100ns (returns immediately)
- If mismatch at i=5: ~150ns (checked 5 bytes first)
- If all match: ~200ns (checked all bytes)
Attack: Try all values for byte 0, find fastest rejection = wrong guess
Repeat for each byte position
```
### Why It Matters on MultiversX
- Gas metering can leak execution path information
- Cross-shard timing differences observable
- VM-level optimizations may vary execution time
## 2. Patterns to Avoid (Variable Time)
### Early Exit Comparisons
```rust
// VULNERABLE: Early exit leaks position of first mismatch
fn compare_secrets(secret: &[u8], input: &[u8]) -> bool {
if secret.len() != input.len() {
return false; // Length leak!
}
for i in 0..secret.len() {
if secret[i] != input[i] {
return false; // Position leak!
}
}
true
}
```
### Short-Circuit Boolean Operators
```rust
// VULNERABLE: && and || short-circuit
fn verify_auth(token_valid: bool, signature_valid: bool) -> bool {
token_valid && signature_valid // If token_valid is false, signature not checked
}
```
### Conditional Branching on Secrets
```rust
// VULNERABLE: Different code paths based on secret value
fn process_key(key: &[u8]) {
if key[0] == 0x00 {
// Fast path
} else {
// Slow path with more operations
}
}
```
### Data-Dependent Memory Access
```rust
// VULNERABLE: Cache timing based on secret value
fn lookup(secret_index: usize, table: &[u8]) -> u8 {
table[secret_index] // Cache hit/miss depends on secret_index
}
```
## 3. MultiversX-Safe Solutions
### Use VM Cryptographic Functions
**BEST PRACTICE**: Always prefer built-in VM crypto operations:
```rust
// CORRECT: Use VM-provided verification
fn verify_signature(&self, message: &ManagedBuffer, signature: &ManagedBuffer) {
let signer = self.expected_signer().get();
// Panics with signal error if verification fails — does NOT return bool
self.crypto().verify_ed25519(
signer.as_managed_buffer(),
message,
signature
);
}
// CORRECT: Use VM-provided hashing
fn hash_data(&self, data: &ManagedBuffer) -> ManagedBuffer {
self.crypto().sha256(data)
}
```
### ManagedBuffer Comparison
The MultiversX VM's `ManagedBuffer` comparison is typically constant-time:
```rust
// CORRECT: ManagedBuffer == uses VM comparison
fn verify_hash(&self, input_hash: &ManagedBuffer) -> bool {
let stored_hash = self.secret_hash().get();
stored_hash == *input_hash // VM handles comparison
}
```
### Manual Constant-Time Comparison (When Necessary)
If you must compare raw bytes:
```rust
// CORRECT: Constant-time byte comparison
fn constant_time_compare(a: &[u8], b: &[u8]) -> bool {
if a.len() != b.len() {From multiversx/mx-ai-skills, MIT.
More from multiversx/mx-ai-skills
- 0.544score
mvx-deploy-flow
multiversx
Deploy MultiversX smart contracts with pre-flight checks, verification, and post-deployment validation.
SkillCFreshness: C★ 12Claude Code +9 - 0.544score
mvx-cross-contract-calls
multiversx
Make cross-contract calls in MultiversX smart contracts.
SkillCFreshness: C★ 12Claude Code +9 - 0.544score
mvx-project-architecture
multiversx
Production-grade project structure patterns for MultiversX smart contracts.
SkillCFreshness: C★ 12Claude Code +9 - 0.544score
mvx-property-testing
multiversx
Use property-based testing and fuzzing to find edge cases in smart contract logic.
SkillCFreshness: C★ 12Claude Code +9 - 0.544score
mvx-debug-tx
multiversx
Debug and analyze MultiversX transactions.
SkillCFreshness: C★ 12Claude Code +9 - 0.544score
mvx-payment-handling
multiversx
Handle payments in MultiversX smart contracts.
SkillCFreshness: C★ 12Claude Code +9 - 0.544score
mvx-audit-onchain
multiversx
Perform a comprehensive on-chain security audit of a deployed MultiversX smart contract.
SkillCFreshness: C★ 12Claude Code +9 - 0.544score
mvx-blockchain-data
multiversx
Read on-chain state in MultiversX smart contracts.
SkillCFreshness: C★ 12Claude Code +9 - 0.544score
mvx-cache-patterns
multiversx
Gas-optimized cache patterns for MultiversX smart contracts using Drop-based write-back caches.
SkillCFreshness: C★ 12Claude Code +9 - 0.544score
mvx-clarification-expert
multiversx
Identify ambiguous requirements and ask targeted clarifying questions for MultiversX development.
SkillCFreshness: C★ 12Claude Code +9 - 0.544score
mvx-test-contract
multiversx
Perform automated on-chain testing of a deployed MultiversX smart contract.
SkillCFreshness: C★ 12Claude Code +9 - 0.544score
mvx-cross-contract-storage
multiversx
Read another contract's storage directly without async calls using storage_mapper_from_address.
SkillCFreshness: C★ 12Claude Code +9
Signals
- Stars
- 12
- Forks
- 4
- Open issues
- 0
- Last commit (this folder)
- Jul 2, 2026 (4 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/multiversx/mx-ai-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from multiversx
- 0.544score
mvx-deploy-flow
multiversx
Deploy MultiversX smart contracts with pre-flight checks, verification, and post-deployment validation.
SkillCFreshness: C★ 12Claude Code +9 - 0.544score
mvx-payment-handling
multiversx
Handle payments in MultiversX smart contracts.
SkillCFreshness: C★ 12Claude Code +9 - 0.544score
mvx-project-architecture
multiversx
Production-grade project structure patterns for MultiversX smart contracts.
SkillCFreshness: C★ 12Claude Code +9 - 0.544score
mvx-property-testing
multiversx
Use property-based testing and fuzzing to find edge cases in smart contract logic.
SkillCFreshness: C★ 12Claude Code +9 - 0.544score
mvx-test-contract
multiversx
Perform automated on-chain testing of a deployed MultiversX smart contract.
SkillCFreshness: C★ 12Claude Code +9 - 0.544score
mvx-debug-tx
multiversx
Debug and analyze MultiversX transactions.
SkillCFreshness: C★ 12Claude Code +9
Cite this page
mvx-constant-time skill. Agent Mart. https://agentmart.dev/skills/multiversx-mvx-constant-time (last updated 2026-10-24)