INNER CODE UNIT · Rust
is_bytecode_similar_lax
fuzzland/ityfuzz · src/evm/blaz/mod.rs:28
pub fn is_bytecode_similar_lax(hay: Vec<u8>, needle: Vec<u8>) -> usize {
skip_cbor!({
let push4_hay: HashSet<_> = extract_sig_from_contract(hex::encode(hay).as_str())
.iter()
.cloned()
.collect();
let push4_needle: HashSet<_> = extract_sig_from_contract(hex::encode(needle).as_str())
.iter()
.cloned()
.collect();
push4_needle.difference(&push4_hay).count() + push4_hay.difference(&push4_needle).count()
})
}
pub fn is_bytecode_similar_strict_ranking(hay: Vec<u8>, needle: Vec<u8>) -> usize {
skip_cbor!({
let constants_hay = find_constants(&Bytecode::new_raw(Bytes::from(hay)));
let constants_needle = find_constants(&Bytecode::new_raw(Bytes::from(needle)));