Skip to content

Add API to Check if Hex String is All Zeroes #89

Open
@borngraced

Description

It would be really helpful if the hex crate had a built-in function to check whether a hex string consists entirely of zeroes. This is a common need in areas like cryptography and blockchain, where it’s often important to confirm if a hexadecimal string represents “nothing” or is effectively all zeroes.

fn is_zeroes(hex_str: &str) -> bool {
...
}

/// USAGE
use hex::is_zeroes;
assert!(is_zeroes("0x000000"));
assert!(!is_zeroes("0x123456"));

Feel free to assign me if this is a W

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions