Skip to main content

Crate djbsort

Crate djbsort 

Source
Expand description

Constant-time sorting network based on DJB’s design.

The sorting network is data-oblivious: the sequence of comparisons and swaps depends only on the array length, never on the values being sorted. This makes it immune to timing side-channels.

Two entry points:

  • sort — SIMD-optimized path for native numeric types.
  • sort_by — generic path with constant-time byte-XOR swap. Requires T: CtSwappable.

Enums§

Order
Sort direction.

Traits§

CtSwappable
Marker trait for types safe to swap via bytewise XOR.
Sortable
Marker trait for types that can be sorted by the native SIMD path.

Functions§

sort
SIMD-optimized sort for native numeric types.
sort_by
Generic sort with constant-time byte-XOR swap.