stackforge_core/utils/mod.rs
1//! Utility functions for packet manipulation.
2//!
3//! This module provides helper functions like hexdump, checksum calculation,
4//! and other common operations used in network programming.
5//!
6//! The utilities are organized into submodules:
7//! - [`hex`]: Hexdump and hex string utilities
8//! - [`checksum`]: Checksum calculation and verification
9//! - [`compare`]: Binary comparison and diff utilities
10//! - [`padding`]: Padding and alignment utilities
11//! - [`bits`]: Bitwise operations and byte order conversions
12//! - [`random`]: Random data generation (feature-gated)
13
14pub mod bits;
15pub mod checksum;
16pub mod compare;
17pub mod hex;
18pub mod padding;
19pub mod random;
20
21// Re-export commonly used functions
22pub use bits::{be_to_u16, be_to_u32, extract_bits, set_bits, u16_to_be, u32_to_be};
23pub use checksum::{
24 finalize_checksum, internet_checksum, partial_checksum, transport_checksum, verify_checksum,
25};
26pub use compare::{byte_diff, find_diff};
27pub use hex::{hexdump, hexstr, hexstr_sep, parse_hex, pretty_bytes};
28pub use padding::{align_to, ethernet_min_frame, pad_to};
29
30#[cfg(feature = "rand")]
31pub use random::{random_bytes, random_mac};