CodeVerify

A sample report

This is what you get. The crate is a small example that splits a restaurant bill, with mistakes in it on purpose.

The code that was checked
//! tiptab: splits a restaurant bill. All amounts are in cents.

mod receipt;
pub use receipt::{seal, sign};

/// The tip for a bill.
pub fn tip(bill: u64, percent: u64) -> u64 {
    bill * percent / 100
}

/// What each person pays.
pub fn split(total: u64, people: u64) -> u64 {
    total / people
}

/// What the guest gets back.
pub fn change(paid: u64, total: u64) -> Option<u64> {
    paid.checked_sub(total)
}

/// The price of one dish on the menu.
pub fn dish(menu: &[u64], number: usize) -> Option<u64> {
    menu.get(number).copied()
}

/// How many people share the bill, as typed by a guest.
pub fn people(typed: &str) -> u64 {
    typed.trim().parse().unwrap()
}

44/100

Needs attention

Found 4 issues (3 high, 1 medium) across 7 functions of core/. 3 were confirmed by running your code; start there. 1 is a code pattern worth a look. 13 of 14 safety questions were answered (10 proved safe, 3 shown to fail).

Issues
4

3 high, 1 medium

Safety questions
10 of 14 proved

3 shown to fail, 1 still open

CISA guideline
Needs work

3 suggestions

Issues

Highsplit can divide by zerocore/src/lib.rs:13Confirmed
What happens

A division or remainder uses a divisor that can be zero. In Rust that panics and stops the request or thread.

How we know

We ran your code with this input and it broke. Found by Kani and 2 other verifiers.

total = 4250, people = 0
What our AI adds

people comes from a form. If a guest leaves it empty or types 0, the whole request stops.

How to fix it
pub fn split(total: u64, people: u64) -> Option<u64> {
    total.checked_div(people)
}

A suggestion, not a tested patch.

F-001
Hightip can overflow when multiplyingcore/src/lib.rs:8Confirmed
What happens

A multiplication can exceed the integer type's range. With overflow checks it panics; without them it silently wraps to a wrong value.

How we know

We ran your code with this input and it broke. Found by Kani and 2 other verifiers.

bill = 18446744073709551615, percent = 2
What our AI adds

Nothing limits bill or percent, so one very large number is enough. In a release build the tip would silently become a wrong amount.

How to fix it
pub fn tip(bill: u64, percent: u64) -> Option<u64> {
    Some(bill.checked_mul(percent)? / 100)
}

A suggestion, not a tested patch.

F-002
Highpeople can panic on unwrapcore/src/lib.rs:28Confirmed
What happens

unwrap() or expect() is called on a value that can be None or Err for some inputs.

How we know

We ran your code with this input and it broke. Found by 2 verifiers.

typed = ""
How to fix it
pub fn people(typed: &str) -> Option<u64> {
    typed.trim().parse().ok()
}

A suggestion, not a tested patch.

F-003
Mediumtip: Money is rounded down (rounding dust)core/src/lib.rs:8Worth a look
What happens

Integer division floors the result; repeated small amounts can escape fees entirely. Decide explicitly whether to round up, down or carry the remainder.

How we know

This kind of code often goes wrong. Nothing broke here. Found by one verifier.

Failing input: Any bill below 100 cents gets a tip of 0 at 1 percent.

How to fix it

Decide how to round: div_ceil(100) rounds up, or carry the rest over to the next bill.

A suggestion, not a tested patch.

F-004

CISA guideline

Needs work

3 of 10 checks need work, 2 couldn't be decided from the code alone, 3 follow the guideline. 1 point should be fixed now.

From the U.S. statement on cryptography of December 2, 2026 by CISA, NSA and the Office of the National Cyber Director. This part is advice and doesn't change the score. The statement binds U.S. federal systems and their suppliers.

HighA secret is written in the codecore/src/receipt.rs:10Check 8
Why

We took it out before your code was sent, so we never saw it. But everyone who sees your code has it.

The code
const UPLOAD_TOKEN: &str = "CODEVERIFY_REMOVED_TOKEN";
What to change

Load it at run time (environment variable, key store, secret manager), and replace this secret.

CG-1
MediumX25519 key exchange without a post-quantum partcore/src/receipt.rs:8Check 2
Why

A future quantum computer could work out these keys, and someone who records the data today could read it then. NIST: not to be used after 2035, and to be replaced from 2030. Executive Order 14412 asks important federal systems to move by the end of 2030.

The code
use x25519_dalek::{EphemeralSecret, PublicKey};
What to change

Use it together with ML-KEM-768 (crate ml-kem, or aws-lc-rs): put both shared secrets into one key with HKDF. Then an attacker has to break both.

All places
  • core/src/receipt.rs:8
  • core/src/receipt.rs:16
  • core/src/receipt.rs:17
  • core/src/receipt.rs:18
CG-2
LowEd25519 signaturescore/src/receipt.rs:5Check 3
Why

A future quantum computer could forge these signatures. NIST: not to be used after 2035, and to be replaced from 2030. Executive Order 14412 asks important federal systems to move by the end of 2031.

The code
use ed25519_dalek::{Signer, SigningKey};
What to change

Plan the move to ML-DSA (crate ml-dsa), or sign with both the old and the new algorithm during the move. For signatures that must last very long, SLH-DSA (crate slh-dsa) is the cautious choice. If a blockchain or another protocol fixes the algorithm, you can't change it alone: keep the algorithm in one place, so you can switch when they do.

All places
  • core/src/receipt.rs:5
  • core/src/receipt.rs:12
CG-3
  1. 1You know which cryptography your code usesHere is the list: 6 uses in your code.Follows
  2. 2Encryption keys are safe from quantum computersX25519 key exchange: a future quantum computer could read what it protects.Needs work
  3. 3Signatures are safe from quantum computersEd25519 signatures: a future quantum computer could forge them.Needs work
  4. 4Nothing retired or unsafe is in useNothing retired was found in your code.Follows
  5. 5Everyday encryption and hashing are strong enoughAES, AES-192 or AES-256, SHA-2: strong enough.Follows
  6. 6Network connections are modernNo network connections with TLS were found.Not used here
  7. 7Algorithms can be swapped quicklyThe code alone doesn't show how hard a switch would be. Nothing with a fixed size was found in saved or sent data.Couldn't tell
  8. 8Keys and random numbers are handled safelySecret written in the code.Needs work
  9. 9Software updates are signed in a future-proof wayNo software updates were found.Not used here
  10. 10Long-lived secrets stay safe past 2030What is encrypted with these keys today could be read later. Does any of it have to stay secret past 2030?Couldn't tell
All cryptography we found (6)
WhatLibraryWhereState
Secret written in the code
Keys
nonecore/src/receipt.rs:10Unsafe
Ed25519 signatures
Signatures
ed25519-dalek core/src/receipt.rs:5 and 1 moreQuantum-vulnerable
X25519 key exchange
Key exchange or encryption with public keys
x25519-dalek core/src/receipt.rs:8 and 3 moreQuantum-vulnerable
AES
Encryption
aes-gcm core/src/receipt.rs:3 and 2 moreStrong
AES-192 or AES-256
Encryption
aes-gcm core/src/receipt.rs:4 and 2 moreStrong
SHA-2
Hashing
sha2 core/src/receipt.rs:7 and 1 moreStrong
  • The statement gives a direction and has no list of code rules. These ten checks come from the published rules behind it.
  • They bind U.S. federal systems and their suppliers. For everyone else they are advice. They don't change the score above.

What was checked

by Verus, Kani and 15+ other verifiers
  • VerusProves that written rules about your code hold for every possible input.3 checks6.1 sFound nothing
  • KaniExplores every input up to a limit and proves that nothing can panic or overflow within it.13 checks24 sFound something
  • 15+ other verifiersLook for memory errors, overflows, crashes, races, risky patterns and rounding mistakes, and check each other's results.26 checks18 sFound something
Memory
The code ran with every memory access checked. Some runs stopped with an error; see the issues.
Files
3 from core. Every file arrived exactly as it was sent.
Secrets
1 left out before sending. They were never sent or stored:
  • core/src/receipt.rs:10: an upload token
This run
3 min 26 s in a S container, with Claude Opus 5.5. It cost 7.6 credits.

Yours is four steps away.

Get started for $1