Skip to content

Commit df75cbc

Browse files
committed
update fuzz/README.md to use hex crate
1 parent 460400d commit df75cbc

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

fuzz/README.md

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -118,28 +118,12 @@ as follows:
118118
```
119119
#[cfg(test)]
120120
mod tests {
121-
fn extend_vec_from_hex(hex: &str, out: &mut Vec<u8>) {
122-
let mut b = 0;
123-
for (idx, c) in hex.as_bytes().iter().enumerate() {
124-
b <<= 4;
125-
match *c {
126-
b'A'...b'F' => b |= c - b'A' + 10,
127-
b'a'...b'f' => b |= c - b'a' + 10,
128-
b'0'...b'9' => b |= c - b'0',
129-
_ => panic!("Bad hex"),
130-
}
131-
if (idx & 1) == 1 {
132-
out.push(b);
133-
b = 0;
134-
}
135-
}
136-
}
121+
use miniscript::bitcoin::hex::FromHex;
137122
138123
#[test]
139124
fn duplicate_crash() {
140-
let mut a = Vec::new();
141-
extend_vec_from_hex("048531e80700ae6400670000af5168", &mut a);
142-
super::do_test(&a);
125+
let v = Vec::from_hex("abcd").unwrap();
126+
super::do_test(&v);
143127
}
144128
}
145129
```

0 commit comments

Comments
 (0)