proofs.rs

Report #1 — Exact slice encoding, decoding and error behavior in the hex 0.4.3 fork

creusot 0.13.0

2 verified claims · 0 findings

Recorded by the author; proofs.rs has not re-run it. How to read a report

nyuichi · 2026-09-24 06:18 UTC

Revision v2 · v1

Overview

In the hex 0.4.3 verification fork, encode_to_slice writes the complete lowercase hexadecimal encoding exactly when the output length is twice the input length. Any other length, including an oversized buffer, returns InvalidStringLength without changing the output.

decode_to_slice accepts uppercase, lowercase and mixed-case hexadecimal digits. It checks odd input length first, then output-length mismatch; either error leaves the output unchanged. With matching lengths, it reports the first invalid byte as InvalidHexCharacter with its character and byte index. Complete pairs before that byte are decoded; the failing pair and remaining output stay unchanged. If every digit is valid, the complete decoded output is written.

The codec loops and error branches pass arithmetic, indexing and panic-freedom checks for arbitrary byte slices and output lengths. The public generic wrappers rely on the trusted AsRef conversion below. These results cover the modified fork with default features disabled on Linux x86_64, not directly the unmodified crates.io release.

Findings (0)

No findings reported.

APIs (2)

Functions

pub fn decode_to_slice<T: AsRef<[u8]>>(data: T, out: &mut [u8]) -> Result<(), FromHexError>
pub fn encode_to_slice<T: AsRef<[u8]>>(input: T, output: &mut [u8]) -> Result<(), FromHexError>

Evidence

https://github.com/nyuichi/rust-crate-proofs/tree/c6d8352aecd423d311f26e64bef3ed37ec950b84

Reproduce

Toolchain source metadata: not recorded.

Run locally

git clone -- https://github.com/nyuichi/rust-crate-proofs report-1-source-1
git -C report-1-source-1 checkout --detach c6d8352aecd423d311f26e64bef3ed37ec950b84
git -C report-1-source-1 submodule update --init --recursive --checkout
cd report-1-source-1/hex/0.4.3

env CREUSOT_DATA_HOME=/workspace/scratch/20d8b4a36f5f/creusot-data-013 WHY3=/workspace/scratch/20d8b4a36f5f/why3-013-install/bin/why3 Z3=/root/.local/share/creusot/bin/z3 WHY3_Z3_DRIVER=/workspace/scratch/20d8b4a36f5f/why3-013-install/share/why3/drivers/z3_4_12.drv python3 verify-core.py

Checks out the recorded source commit from GitHub. Install the report’s tool version before running.

Source on GitHub · SARIF with logs (.json)

Recorded run

Completed · 167 checks passed · 0 failed

2026-09-24T05:36:01.565Z · 36.1 seconds · Exit code 0

Recorded on the author’s machine.

CheckResultClaim
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::decode_to_slice
PassedClaim #1
Z3 returned unsat for the negated verification condition
hex::decode_to_slice
PassedClaim #1
Z3 returned unsat for the negated verification condition
hex::decode_to_slice
PassedClaim #1
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_slice_impl
Passed—
Z3 returned unsat for the negated verification condition
hex::encode_to_slice
PassedClaim #2
Z3 returned unsat for the negated verification condition
hex::encode_to_slice
PassedClaim #2
Z3 returned unsat for the negated verification condition
hex::encode_to_slice
PassedClaim #2
Z3 returned unsat for the negated verification condition
hex::error::impl_Clone_for_FromHexError::clone
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_Clone_for_FromHexError::clone__refines
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_Clone_for_FromHexError::clone__refines
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_PartialEq_for_FromHexError::eq
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_PartialEq_for_FromHexError::eq
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_PartialEq_for_FromHexError::eq
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_PartialEq_for_FromHexError::eq
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_PartialEq_for_FromHexError::eq
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_PartialEq_for_FromHexError::eq
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_PartialEq_for_FromHexError::eq
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_PartialEq_for_FromHexError::eq
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_PartialEq_for_FromHexError::eq
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_PartialEq_for_FromHexError::eq
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_PartialEq_for_FromHexError::eq
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_PartialEq_for_FromHexError::eq
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_PartialEq_for_FromHexError::eq
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_PartialEq_for_FromHexError::eq
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_PartialEq_for_FromHexError::eq__refines
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_PartialEq_for_FromHexError::eq__refines
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_PartialEq_for_FromHexError::eq__refines
Passed—
Z3 returned unsat for the negated verification condition
hex::error::impl_PartialEq_for_FromHexError::eq__refines
Passed—
Z3 returned unsat for the negated verification condition
hex::hex_digit_value
Passed—
Z3 returned unsat for the negated verification condition
hex::hex_digit_value
Passed—
Z3 returned unsat for the negated verification condition
hex::hex_digit_value
Passed—
Z3 returned unsat for the negated verification condition
hex::hex_digit_value
Passed—
Z3 returned unsat for the negated verification condition
hex::hex_digit_value
Passed—
Z3 returned unsat for the negated verification condition
hex::hex_digit_value
Passed—
Z3 returned unsat for the negated verification condition
hex::hex_digit_value
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_FromHex_for_array_u8_n::from_hex
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_FromHex_for_array_u8_n::from_hex
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_FromHex_for_array_u8_n::from_hex
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_FromHex_for_array_u8_n::from_hex
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_FromHex_for_array_u8_n::from_hex
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_FromHex_for_array_u8_n::from_hex
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_FromHex_for_array_u8_n::from_hex
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_FromHex_for_array_u8_n::from_hex
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_FromHex_for_array_u8_n::from_hex
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_FromHex_for_array_u8_n::from_hex__refines
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_FromHex_for_array_u8_n::from_hex__refines
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_FromHex_for_array_u8_n::from_hex__refines
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_ToHex_for_T::encode_hex
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_ToHex_for_T::encode_hex
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_ToHex_for_T::encode_hex__refines
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_ToHex_for_T::encode_hex__refines
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_ToHex_for_T::encode_hex__refines
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_ToHex_for_T::encode_hex_upper
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_ToHex_for_T::encode_hex_upper
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_ToHex_for_T::encode_hex_upper__refines
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_ToHex_for_T::encode_hex_upper__refines
Passed—
Z3 returned unsat for the negated verification condition
hex::impl_ToHex_for_T::encode_hex_upper__refines
Passed—
Z3 returned unsat for the negated verification condition
hex::is_hex_digit
Passed—
Z3 returned unsat for the negated verification condition
hex::is_hex_digit
Passed—
Z3 returned unsat for the negated verification condition
hex::is_hex_digit
Passed—
Z3 returned unsat for the negated verification condition
hex::is_hex_digit
Passed—
Z3 returned unsat for the negated verification condition
hex::is_hex_digit
Passed—
Z3 returned unsat for the negated verification condition
hex::is_hex_digit
Passed—
Z3 returned unsat for the negated verification condition
hex::is_hex_digit
Passed—
Z3 returned unsat for the negated verification condition
hex::is_hex_digit
Passed—
Z3 returned unsat for the negated verification condition
hex::is_hex_digit
Passed—
Z3 returned unsat for the negated verification condition
hex::is_hex_digit
Passed—
Z3 returned unsat for the negated verification condition
hex::is_hex_digit
Passed—
Z3 returned unsat for the negated verification condition
hex::lower_hex_byte
Passed—
Z3 returned unsat for the negated verification condition
hex::lower_hex_byte
Passed—
Z3 returned unsat for the negated verification condition
hex::lower_hex_byte
Passed—
Z3 returned unsat for the negated verification condition
hex::lower_hex_byte
Passed—
Z3 returned unsat for the negated verification condition
hex::lower_hex_byte
Passed—
Z3 returned unsat for the negated verification condition
hex::lower_hex_digit
Passed—
Z3 returned unsat for the negated verification condition
hex::lower_hex_digit
Passed—
Z3 returned unsat for the negated verification condition
hex::upper_hex_digit
Passed—
Z3 returned unsat for the negated verification condition
hex::upper_hex_digit
Passed—
Z3 returned unsat for the negated verification condition
hex::val
Passed—
Z3 returned unsat for the negated verification condition
hex::val
Passed—
Z3 returned unsat for the negated verification condition
hex::val
Passed—
Z3 returned unsat for the negated verification condition
hex::val
Passed—
Z3 returned unsat for the negated verification condition
hex::val
Passed—
Z3 returned unsat for the negated verification condition
hex::val
Passed—
Z3 returned unsat for the negated verification condition
hex::val
Passed—
Z3 returned unsat for the negated verification condition
hex::val
Passed—
Z3 returned unsat for the negated verification condition
hex::val
Passed—
Z3 returned unsat for the negated verification condition
hex::val
Passed—
Z3 returned unsat for the negated verification condition
hex::val
Passed—
Execution details
Started
2026-09-24T05:36:01.565Z
Finished
2026-09-24T05:36:37.655Z
Platform
linux x86_64
Rust compiler
rustc 1.98.0-nightly (91fe22da8 2026-06-21) binary: rustc commit-hash: 91fe22da8084a1c9e993d78d4a56f22ab8396236 commit-date: 2026-06-21 host: x86_64-unknown-linux-gnu release: 1.98.0-nightly LLVM version: 22.1.7
Working directory
hex/0.4.3
Environment overrides
CREUSOT_DATA_HOME=/workspace/scratch/20d8b4a36f5f/creusot-data-013 WHY3=/workspace/scratch/20d8b4a36f5f/why3-013-install/bin/why3 Z3=/root/.local/share/creusot/bin/z3 WHY3_Z3_DRIVER=/workspace/scratch/20d8b4a36f5f/why3-013-install/share/why3/drivers/z3_4_12.drv
Git repository
https://github.com/nyuichi/rust-crate-proofs
Git commit
c6d8352aecd423d311f26e64bef3ed37ec950b84
Diagnostics & logs
=== stdoutStderr ===
   Compiling proc-macro2 v1.0.106
   Compiling unicode-ident v1.0.24
   Compiling libc v0.2.186
   Compiling quote v1.0.46
   Compiling getrandom v0.4.3
   Compiling cfg-if v1.0.4
   Compiling syn v2.0.119
   Compiling uuid v1.26.1
   Compiling pearlite-syn v0.13.0
   Compiling creusot-std-proc v0.13.0
    Checking creusot-std v0.13.0
    Checking hex v0.4.3 (/tmp/hex-record-wh9vdw_h/hex/0.4.3)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 27.84s
Proved 167/167 obligations from 20 Coma files
Environment

Linux x86_64; --no-default-features; Rust nightly-2026-06-22 (91fe22da8). Creusot 0.13.0 and creusot-std 0.13.0; unmodified Why3 54c92f96bb0711d6e991c18f10bfbc08d90d028b; Z3 4.15.3. Source: c6d8352aecd423d311f26e64bef3ed37ec950b84, hex/0.4.3. The attached 2026-09-24 SARIF records python3 verify-core.py: 167 successful obligations from 20 Coma files, exported with split_vc and z3_4_12 and checked directly by Z3. CREUSOT-0.13.md describes reproduction. This revision reuses that recording without rerunning verification.

What is trusted

The generic AsRef<[u8]> bridge is assumed to return normally with the byte slice described by the input's logical model. Both public wrappers depend on this correspondence. A user-defined AsRef implementation that panics is not covered by the codec's panic-freedom result. The codec loops and error branches have body proofs; Creusot's core-operation models remain assumptions.

Technical limitations

The fork extracts the slice cores, uses high * 16 + low to combine decoded nibbles, and checks the exact encoding length through division/remainder instead of input.len() * 2. The recorded proof checks these modified bodies and their contracts; it does not formally establish equivalence to all behavior of the published crate. Alloc-backed convenience functions, formatting, serde, other generic adapters and other feature configurations are outside this report. Machine-readable claims remain panic_contract; exact codec behavior is supported by the source postconditions and recorded proofs.

Tool limitations

Verification is relative to the supplied specifications and trusted contracts. Results apply to the compilation target used for verification. The standard-library specifications do not exclude all panics: Vec capacity overflow in operations such as push, insert, and extend is not ruled out, including for vectors of zero-sized types. Out-of-memory failures are also outside the guarantees. The standard vec! macro is unsupported; verified code must use the Creusot replacement where needed. Reference: https://github.com/creusot-rs/creusot/blob/v0.13.0/guide/src/limitations.md

Updated 2026-09-24 05:03 UTC

creusot 0.13.0 — version details

Dependencies (8)

CrateReports
criterion ^0.3 · dev—
faster-hex ^0.5 · dev—
pretty_assertions ^0.6 · dev—
rustc-hex ^2.1 · dev—
serde ^1.0 · dev—
serde ^1.0 · optional—
serde_json ^1.0 · dev—
version-sync ^0.9 · dev—

Comments (0)

No comments.

Sign in to comment.