Skip to main content

Module utils

Module utils 

Source
Expand description

Utility functions for packet manipulation.

This module provides helper functions like hexdump, checksum calculation, and other common operations used in network programming.

The utilities are organized into submodules:

  • hex: Hexdump and hex string utilities
  • checksum: Checksum calculation and verification
  • compare: Binary comparison and diff utilities
  • padding: Padding and alignment utilities
  • bits: Bitwise operations and byte order conversions
  • random: Random data generation (feature-gated)

Re-exports§

pub use bits::be_to_u16;
pub use bits::be_to_u32;
pub use bits::extract_bits;
pub use bits::set_bits;
pub use bits::u16_to_be;
pub use bits::u32_to_be;
pub use checksum::finalize_checksum;
pub use checksum::internet_checksum;
pub use checksum::partial_checksum;
pub use checksum::transport_checksum;
pub use checksum::verify_checksum;
pub use compare::byte_diff;
pub use compare::find_diff;
pub use hex::hexdump;
pub use hex::hexstr;
pub use hex::hexstr_sep;
pub use hex::parse_hex;
pub use hex::pretty_bytes;
pub use padding::align_to;
pub use padding::ethernet_min_frame;
pub use padding::pad_to;
pub use random::random_bytes;
pub use random::random_mac;

Modules§

bits
Bitwise operations and byte order conversions.
checksum
Checksum calculation and verification utilities.
compare
Binary comparison and diff utilities.
hex
Hexdump and hex string utilities.
padding
Padding and alignment utilities.
random
Random data generation utilities (feature-gated).