Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
borngraced opened this issue Oct 31, 2024 · 0 comments
Open

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

borngraced opened this issue Oct 31, 2024 · 0 comments

Comments

@borngraced
Copy link

borngraced commented Oct 31, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant