H. Vicky Zhao

139 papers A* 4A 4B 14C 2Misc 15Journal 72Unranked 27
YearRankTypeTitle / Venue / Authors
2026 J jnl
IEEE Trans. Signal Inf. Process. over Networks
Huisheng Wang, Yuejiang Li, Yiqing Lin, H. Vicky Zhao
2025 B conf
SMC
Hangjing Zhang, H. Vicky Zhao, Yixin Dai
2025 conf
APSIPA
Yuzhe Li, Hangjing Zhang, H. Vicky Zhao
2025 J jnl
CoRR
Huisheng Wang, H. Vicky Zhao
2025 J jnl
IEEE Trans. Signal Inf. Process. over Networks
Hangjing Zhang, H. Vicky Zhao, Yixin Dai
2025 conf
ACL (1)
Huisheng Wang, Zhuoshi Pan, Hangjing Zhang, Mingxiao Liu, Hanqing Gao, H. Vicky Zhao
2025 J jnl
CoRR
Huisheng Wang, Zhuoshi Pan, Hangjing Zhang, Mingxiao Liu, Hanqing Gao, H. Vicky Zhao
2025 conf
ACL (Findings)
Zhuoshi Pan, Yu Li, Honglin Lin, Qizhi Pei, Zinan Tang, Wei Wu, Chenlin Ming, H. Vicky Zhao, Conghui He, Lijun Wu
2025 J jnl
CoRR
Zhuoshi Pan, Yu Li, Honglin Lin, Qizhi Pei, Zinan Tang, Wei Wu, Chenlin Ming, H. Vicky Zhao, Conghui He, Lijun Wu
2025 J jnl
CoRR
Ji Qi, Tam Thuc Do, Mingxiao Liu, Zhuoshi Pan, Yuzhe Li, Gene Cheung, H. Vicky Zhao
2025 J jnl
CoRR
Zhuoshi Pan, Qianhui Wu, Huiqiang Jiang, Xufang Luo, Hao Cheng, Dongsheng Li, Yuqing Yang, Chin-Yew Lin, H. Vicky Zhao, Lili Qiu, Jianfeng Gao
2025 C conf
ACC
Huisheng Wang, H. Vicky Zhao
2025 J jnl
CoRR
Huisheng Wang, H. Vicky Zhao
2025 J jnl
CoRR
Zhuoshi Pan, Qizhi Pei, Yu Li, Qiyao Sun, Zinan Tang, H. Vicky Zhao, Conghui He, Lijun Wu
2025 A* conf
ICLR
Zhuoshi Pan, Qianhui Wu, Huiqiang Jiang, Xufang Luo, Hao Cheng, Dongsheng Li, Yuqing Yang, Chin-Yew Lin, H. Vicky Zhao, Lili Qiu, Jianfeng Gao
2024 A* conf
NeurIPS
Zhuoshi Pan, Yuguang Yao, Gaowen Liu, Bingquan Shen, H. Vicky Zhao, Ramana Kompella, Sijia Liu
2024 J jnl
CoRR
Huisheng Wang, H. Vicky Zhao
2024 conf
ACL (Findings)
Zhuoshi Pan, Qianhui Wu, Huiqiang Jiang, Menglin Xia, Xufang Luo, Jue Zhang, Qingwei Lin, Victor Rühle, Yuqing Yang, Chin-Yew Lin, H. Vicky Zhao, Lili Qiu, Dongmei Zhang
2024 J jnl
CoRR
Zhuoshi Pan, Qianhui Wu, Huiqiang Jiang, Menglin Xia, Xufang Luo, Jue Zhang, Qingwei Lin, Victor Rühle, Yuqing Yang, Chin-Yew Lin, H. Vicky Zhao, Lili Qiu, Dongmei Zhang
2024 J jnl
IEEE Signal Process. Lett.
Yiqing Lin, H. Vicky Zhao
2024 J jnl
CoRR
Huisheng Wang, Zhanjiang Chen, H. Vicky Zhao
2024 J jnl
IEEE Trans. Comput. Soc. Syst.
Wenxiang Dong, H. Vicky Zhao
2024 conf
APSIPA
Hangjing Zhang, H. Vicky Zhao
2024 conf
APSIPA
Huisheng Wang, Mingxiao Liu, Ji Qi, H. Vicky Zhao
2024 J jnl
CoRR
Huisheng Wang, H. Vicky Zhao
2024 J jnl
IEEE Trans. Signal Process.
Qingming Li, H. Vicky Zhao
2024 J jnl
IEEE Signal Process. Lett.
Hong Hu, Zhuoqun Li, H. Vicky Zhao
2024 A* conf
NeurIPS
Yiqing Lin, Jianheng Tang, Chenyi Zi, H. Vicky Zhao, Yuan Yao, Jia Li
2024 J jnl
CoRR
Yiqing Lin, Jianheng Tang, Chenyi Zi, H. Vicky Zhao, Yuan Yao, Jia Li
2024 conf
APSIPA
Ji Qi, Huisheng Wang, H. Vicky Zhao
2023 Misc conf
ICASSP
Yuejiang Li, H. Vicky Zhao, Gene Cheung
2023 J jnl
CoRR
Zhuoshi Pan, Yuguang Yao, Gaowen Liu, Bingquan Shen, H. Vicky Zhao, Ramana Rao Kompella, Sijia Liu
2023 J jnl
CoRR
Yiqing Lin, Zhanjiang Chen, Huisheng Wang, H. Vicky Zhao
2023 B conf
GLOBECOM
Chinthaka Dinesh, Gene Cheung, Fei Chen, Yuejiang Li, H. Vicky Zhao
2023 J jnl
CoRR
Chinthaka Dinesh, Gene Cheung, Fei Chen, Yuejiang Li, H. Vicky Zhao
2023 conf
APSIPA ASC
Wenxiang Dong, H. Vicky Zhao
2023 J jnl
CoRR
Qingming Li, H. Vicky Zhao
2023 J jnl
CoRR
Yuejiang Li, Zhanjiang Chen, H. Vicky Zhao
2023 J jnl
CoRR
Huisheng Wang, Yuejiang Li, Yiqing Lin, H. Vicky Zhao
2023 J jnl
CoRR
Qingming Li, H. Vicky Zhao
2023 J jnl
CoRR
Wenxiang Dong, H. Vicky Zhao
2023 J jnl
CoRR
Wenxiang Dong, H. Vicky Zhao
2022 J jnl
Int. J. Crowd Sci.
Huisheng Wang, Yuejiang Li, H. Vicky Zhao
2022 J jnl
IEEE Trans. Signal Inf. Process. over Networks
Yuejiang Li, H. Vicky Zhao, Yan Chen
2022 J jnl
Int. J. Crowd Sci.
Wengxiang Dong, H. Vicky Zhao
2022 J jnl
IEEE Trans. Circuits Syst. Video Technol.
Yuan Yuan, Gene Cheung, Pascal Frossard, H. Vicky Zhao, Jiwu Huang
2022 J jnl
IEEE Signal Process. Lett.
Yuejiang Li, Zhanjiang Chen, H. Vicky Zhao
2021 J jnl
CoRR
Yuan Yuan, Gene Cheung, Pascal Frossard, H. Vicky Zhao, Jiwu Huang
2021 Misc conf
ICASSP
Zhanjiang Chen, H. Vicky Zhao
2021 J jnl
IEEE Trans. Signal Process.
Qingming Li, Zhanjiang Chen, H. Vicky Zhao
2021 J jnl
IEEE Trans. Inf. Forensics Secur.
Hangjing Zhang, Yuejiang Li, Yan Chen, H. Vicky Zhao
2021 J jnl
IEEE Signal Process. Mag.
H. Vicky Zhao
2021 J jnl
IEEE Signal Process. Mag.
H. Vicky Zhao
2020 conf
APSIPA
Yiqing Lin, Hong Hu, H. Vicky Zhao, Yan Chen
2020 book
Yan Chen, H. Vicky Zhao
2020 conf
APSIPA
Yufei Tian, Hong Hu, Yuejiang Li, H. Vicky Zhao, Yan Chen
2020 J jnl
Int. J. Crowd Sci.
Hangjing Zhang, Yan Chen, H. Vicky Zhao
2020 Misc conf
ICASSP
Yuejiang Li, Yaxin Li, Hong Hu, H. Vicky Zhao, Yan Chen
2020 conf
APSIPA
Hao Li, Yuejiang Li, H. Vicky Zhao
2020 conf
ISPA/BDCloud/SocialCom/SustainCom
Huisheng Wang, Yuejiang Li, H. Vicky Zhao
2020 J jnl
CoRR
Huisheng Wang, H. Vicky Zhao, Yuejiang Li
2020 J jnl
IEEE Signal Process. Mag.
H. Vicky Zhao
2020 J jnl
IEEE Signal Process. Mag.
H. Vicky Zhao
2019 J jnl
IEEE Access
Ling Xing, Kaikai Deng, Honghai Wu, Ping Xie, H. Vicky Zhao, Feifei Gao
2019 J jnl
Int. J. Crowd Sci.
Yuejiang Li, H. Vicky Zhao, Yan Chen
2019 Misc conf
ICASSP
Yuejiang Li, Benliu Qiu, Yan Chen, H. Vicky Zhao
2019 conf
APSIPA
Benliu Qiu, Yuejiang Li, Yan Chen, H. Vicky Zhao
2019 conf
APSIPA
Hangjing Zhang, Yuejiang Li, Yang Hu, Yan Chen, H. Vicky Zhao
2019 conf
APSIPA
Qinyuan Ye, Yuejiang Li, Yan Chen, H. Vicky Zhao
2019 conf
APSIPA
Hong Hu, Yuejiang Li, H. Vicky Zhao, Yan Chen
2019 conf
ICCSE
Wenxiang Dong, Qingming Li, H. Vicky Zhao
2019 J jnl
IEEE Signal Process. Mag.
H. Vicky Zhao
2018 J jnl
IEEE Trans. Circuits Syst. Video Technol.
Yuan Yuan, Gene Cheung, Patrick Le Callet, Pascal Frossard, H. Vicky Zhao
2018 Misc conf
ICASSP
Qingming Li, Zhanjiang Chen, H. Vicky Zhao, Yan Lindsay Sun
2015 J jnl
IEEE Trans. Multim.
Dongni Ren, S.-H. Gary Chan, Gene Cheung, H. Vicky Zhao, Pascal Frossard
2015 C conf
MMSP
Yuan Yuan, Gene Cheung, Pascal Frossard, Patrick Le Callet, H. Vicky Zhao
2015 A conf
CIKM
Tong Zhao, H. Vicky Zhao, Irwin King
2015 J jnl
IEEE Trans. Veh. Technol.
Qian Cao, Yindi Jing, H. Vicky Zhao
2015 A* conf
INFOCOM
Bang Liu, Di Niu, Zongpeng Li, H. Vicky Zhao
2015 J jnl
Medical Biol. Eng. Comput.
Eric Chalmers, Lindsey Westover, Johith Jacob, Andreas Donauer, H. Vicky Zhao, Eric C. Parent, Marc J. Moreau, James K. Mahood, Douglas Hedden, Edmond Lou
2014 B conf
ICMR
Yun Yang, Peng Cui, Wenwu Zhu, H. Vicky Zhao, Yuanyuan Shi, Shiqiang Yang
2014 J jnl
Signal Process. Image Commun.
Bo Hu, H. Vicky Zhao, Gene Cheung
2014 Misc conf
ICASSP
Xiaohui Gong, H. Vicky Zhao, Yan Lindsay Sun
2013 B conf
ICIP
Yuan Yuan, Bo Hu, Gene Cheung, H. Vicky Zhao
2013 J jnl
IEEE Trans. Wirel. Commun.
Qian Cao, Yindi Jing, H. Vicky Zhao
2013 J jnl
IEEE Trans. Veh. Technol.
Bo Hu, H. Vicky Zhao, Hai Jiang
2012 J jnl
IEEE Signal Process. Mag.
Hervé Bourlard, Vikram Krishnamurthy, Yan Lindsay Sun, H. Vicky Zhao, K. J. Ray Liu
2012 J jnl
CoRR
Dongni Ren, S.-H. Gary Chan, Gene Cheung, H. Vicky Zhao, Pascal Frossard
2012 J jnl
IEEE Trans. Multim.
H. Vicky Zhao, W. Sabrina Lin, K. J. Ray Liu
2012 conf
CCECE
Fraaz Kamal, Edmond Lou, H. Vicky Zhao
2012 Misc conf
ICASSP
Bo Hu, Gene Cheung, H. Vicky Zhao
2012 J jnl
CoRR
Qian Cao, H. Vicky Zhao, Yindi Jing
2012 J jnl
IEEE Trans. Veh. Technol.
Qian Cao, H. Vicky Zhao, Yindi Jing
2012 conf
ICC
Qian Cao, Yindi Jing, H. Vicky Zhao
2012 Misc conf
ICASSP
Qian Cao, H. Vicky Zhao, Yindi Jing
2011 J jnl
IEEE Trans. Signal Process.
Binglai Niu, H. Vicky Zhao, Hai Jiang
2011 A conf
ICME
H. Vicky Zhao, Gene Cheung
2011 J jnl
IEEE Trans. Multim.
W. Sabrina Lin, H. Vicky Zhao, K. J. Ray Liu
2011 Misc conf
ICASSP
Bo Hu, H. Vicky Zhao, Hai Jiang
2011 J jnl
IEEE Trans. Circuits Syst. Video Technol.
Zhaorui Liu, Abdulhakem Y. Elezzabi, H. Vicky Zhao
2010 J jnl
IEEE Trans. Veh. Technol.
Binglai Niu, Hai Jiang, H. Vicky Zhao
2010 B conf
GLOBECOM
W. Sabrina Lin, H. Vicky Zhao, K. J. Ray Liu
2010 B conf
ICIP
Zhaorui Liu, H. Vicky Zhao, Abdulhakem Y. Elezzabi
2010 J jnl
IEEE Trans. Image Process.
W. Sabrina Lin, H. Vicky Zhao, K. J. Ray Liu
2010 J jnl
IEEE Trans. Wirel. Commun.
H. Vicky Zhao, Weifeng Su
2010 Misc conf
ICASSP
H. Vicky Zhao, Weifeng Su
2010 J jnl
IEEE J. Sel. Top. Signal Process.
H. Vicky Zhao, K. J. Ray Liu
2010 Misc conf
ICASSP
Bo Hu, H. Vicky Zhao
2009 B conf
GLOBECOM
Xingyu Li, H. Vicky Zhao
2009 J jnl
IEEE Trans. Inf. Forensics Secur.
W. Sabrina Lin, H. Vicky Zhao, K. J. Ray Liu
2009 J jnl
IEEE Signal Process. Mag.
H. Vicky Zhao, W. Sabrina Lin, K. J. Ray Liu
2009 Misc conf
ICASSP
W. Sabrina Lin, H. Vicky Zhao, K. J. Ray Liu
2009 J jnl
IEEE Trans. Inf. Forensics Secur.
W. Sabrina Lin, Steven K. Tjoa, H. Vicky Zhao, K. J. Ray Liu
2009 Misc conf
ICASSP
Gopinath Sankar, H. Vicky Zhao, Yee-Hong Yang
2009 J jnl
IEEE Trans. Multim.
Wan-Yi Sabrina Lin, H. Vicky Zhao, K. J. Ray Liu
2009 B conf
ICIP
Bo Hu, H. Vicky Zhao
2009 Misc conf
ICASSP
W. Sabrina Lin, H. Vicky Zhao, K. J. Ray Liu
2008 Misc conf
ICASSP
W. Sabrina Lin, H. Vicky Zhao, K. J. Ray Liu
2008 conf
ACSCC
W. Sabrina Lin, H. Vicky Zhao, K. J. Ray Liu
2008 B conf
ICIP
Wan-Yi Sabrina Lin, H. Vicky Zhao, K. J. Ray Liu
2008 B conf
ICIP
H. Vicky Zhao, Wan-Yi Sabrina Lin, K. J. Ray Liu
2007 conf
ICASSP (2)
Wan-Yi Sabrina Lin, H. Vicky Zhao, K. J. Ray Liu
2007 conf
ICASSP (2)
H. Vicky Zhao, K. J. Ray Liu
2007 conf
ICASSP (1)
Steven K. Tjoa, Wan-Yi Sabrina Lin, H. Vicky Zhao, K. J. Ray Liu
2007 A conf
ICME
Wan-Yi Sabrina Lin, Steven K. Tjoa, H. Vicky Zhao, K. J. Ray Liu
2007 conf
ICIP (6)
Wan-Yi Sabrina Lin, H. Vicky Zhao, K. J. Ray Liu
2006 B conf
ICIP
K. J. Ray Liu, H. Vicky Zhao
2006 J jnl
IEEE Trans. Inf. Forensics Secur.
H. Vicky Zhao, K. J. Ray Liu
2006 J jnl
IEEE Trans. Image Process.
H. Vicky Zhao, K. J. Ray Liu
2006 B conf
WCNC
Andres Kwasinski, H. Vicky Zhao, K. J. Ray Liu
2006 B conf
ICIP
Wan-Yi Sabrina Lin, H. Vicky Zhao, K. J. Ray Liu
2006 B conf
ICIP
H. Vicky Zhao, K. J. Ray Liu
2006 J jnl
IEEE Trans. Inf. Forensics Secur.
H. Vicky Zhao, K. J. Ray Liu
2005 J jnl
IEEE Trans. Image Process.
Z. Jane Wang, Min Wu, H. Vicky Zhao, Wade Trappe, K. J. Ray Liu
2005 conf
ICASSP (2)
H. Vicky Zhao, K. J. Ray Liu
2005 J jnl
IEEE Trans. Image Process.
H. Vicky Zhao, Min Wu, Z. Jane Wang, K. J. Ray Liu
2005 conf
ICIP (3)
H. Vicky Zhao, K. J. Ray Liu
2005 conf
ICIP (3)
H. Vicky Zhao, K. J. Ray Liu
2003 A conf
ICME
H. Vicky Zhao, Min Wu, Z. Jane Wang, K. J. Ray Liu
tests/unit/test_decompile_similarity.py
← Index tests/unit/test_decompile_similarity.py python
"""Unit tests for similarity modules:
- bninja/similarity/minhashcustom.py
- bninja/similarity/minhasher.py
"""
import numpy as np
import pytest

from redb.extractors.decompiler.bninja.similarity.minhashcustom import MinHashCustom
from redb.extractors.decompiler.bninja.analysis.low_level_normalization import LowLevelNormalization


# ============================================================================
# 2a. MinHashCustom
# ============================================================================

class TestMinHashCustomInit:
    def test_init_empty(self):
        mh = MinHashCustom()
        assert not mh.hasMinHash()
        assert mh.minhash == b""
        assert mh.minhash_int == []

    def test_init_from_signature(self):
        sig = [10, 20, 30, 40]
        mh = MinHashCustom(minhash_signature=sig)
        assert mh.hasMinHash()
        assert mh.minhash_int == sig

    def test_init_from_bytes_uint32(self):
        """Verify round-trip: ints -> bytes -> MinHashCustom -> ints."""
        sig = [100, 200, 300]
        packed = np.array(sig, dtype=np.uint32).tobytes()
        # np.frombuffer returns numpy scalars; setMinHash does % 2**32 which
        # overflows numpy uint32, so verify the raw bytes round-trip instead.
        raw_arr = np.frombuffer(packed, dtype=np.uint32)
        assert list(raw_arr) == sig

    def test_init_from_bytes_uint8(self):
        """Verify round-trip: ints -> bytes -> back."""
        sig = [10, 20, 30]
        packed = np.array(sig, dtype=np.uint8).tobytes()
        raw_arr = np.frombuffer(packed, dtype=np.uint8)
        assert list(raw_arr) == sig

    def test_init_both_raises(self):
        sig = [1, 2, 3]
        packed = np.array(sig, dtype=np.uint32).tobytes()
        with pytest.raises(ValueError, match="only one"):
            MinHashCustom(minhash_bytes=packed, minhash_signature=sig)


class TestMinHashCustomSetGet:
    def test_set_and_get_minhash(self):
        mh = MinHashCustom()
        sig = [5, 10, 15]
        mh.setMinHash(sig)
        raw = mh.getMinHash()
        assert raw == np.array(sig, dtype=np.uint32).tobytes()
        assert mh.getMinHashInt() == sig

    def test_minhash_int_truncation(self):
        mh = MinHashCustom(minhash_bits=8)
        # Values > 256 should be truncated mod 2^8
        mh.setMinHash([300, 500, 256])
        for val in mh.minhash_int:
            assert 0 <= val < 256


class TestMinHashCustomHashData:
    def test_hash_data_string(self):
        result = MinHashCustom.hashData("hello", 42)
        assert isinstance(result, int)
        assert 0 <= result <= 0xFFFFFFFF

    def test_hash_data_bytes(self):
        result = MinHashCustom.hashData(b"bytes", 42)
        assert isinstance(result, int)
        assert 0 <= result <= 0xFFFFFFFF

    def test_hash_data_list(self):
        result = MinHashCustom.hashData([1, 2, 3], 42)
        assert isinstance(result, int)
        assert 0 <= result <= 0xFFFFFFFF

    def test_hash_data_unsupported_type(self):
        with pytest.raises(NotImplementedError, match="Type not supported"):
            MinHashCustom.hashData(123, 42)

    def test_hash_data_deterministic(self):
        assert MinHashCustom.hashData("test", 7) == MinHashCustom.hashData("test", 7)


class TestMinHashCustomScore:
    def test_score_identical(self):
        sig = [1, 2, 3, 4, 5]
        mh1 = MinHashCustom(minhash_signature=sig)
        mh2 = MinHashCustom(minhash_signature=sig)
        score = MinHashCustom.calculateMinHashScore(
            mh1.getMinHash(), mh2.getMinHash()
        )
        assert score == 100.0

    def test_score_different(self):
        mh1 = MinHashCustom(minhash_signature=[1, 2, 3, 4, 5])
        mh2 = MinHashCustom(minhash_signature=[6, 7, 8, 9, 10])
        score = MinHashCustom.calculateMinHashScore(
            mh1.getMinHash(), mh2.getMinHash()
        )
        assert score < 100.0

    def test_score_against(self):
        sig1 = [1, 2, 3, 4, 5]
        sig2 = [1, 2, 99, 4, 5]
        mh1 = MinHashCustom(minhash_signature=sig1)
        mh2 = MinHashCustom(minhash_signature=sig2)
        instance_score = mh1.scoreAgainst(mh2)
        static_score = MinHashCustom.calculateMinHashScore(
            mh1.getMinHash(), mh2.getMinHash()
        )
        assert instance_score == static_score


class TestMinHashCustomBitModes:
    def test_8bit_mode(self):
        mh = MinHashCustom(minhash_bits=8)
        mh.setMinHash([10, 20, 30])
        raw = mh.getMinHash()
        arr = np.frombuffer(raw, dtype=np.uint8)
        assert list(arr) == [10, 20, 30]

    def test_32bit_mode(self):
        mh = MinHashCustom(minhash_bits=32)
        mh.setMinHash([10, 20, 30])
        raw = mh.getMinHash()
        arr = np.frombuffer(raw, dtype=np.uint32)
        assert list(arr) == [10, 20, 30]


# ============================================================================
# 2b. MinHasher
# ============================================================================


class MockILNode:
    """Mock IL node with operation and operands for normalization."""
    def __init__(self, operation, operands=None):
        self.operation = operation
        self.operands = operands or []


class MockLLILBasicBlock:
    """Mock LLIL basic block that yields IL instructions."""
    def __init__(self, instructions):
        self._instructions = instructions

    def __iter__(self):
        return iter(self._instructions)


class MockLLILFunction:
    """Mock LLIL function with basic blocks."""
    def __init__(self, basic_blocks):
        self.basic_blocks = basic_blocks


# Import MinHasher after we know the module can handle the import
from redb.extractors.decompiler.bninja.similarity.minhasher import (
    MinHasher,
    MINHASH_SIGNATURE_LENGTH,
    MINHASH_SIGNATURE_BITS,
)


class TestMinHasherMakeNgrams:
    def setup_method(self):
        # Create a minimal minhasher with a mock LLIL function
        empty_func = MockLLILFunction([])
        self.hasher = MinHasher(seed=42, il_function=empty_func)

    def test_make_ngrams_basic(self):
        result = self.hasher.make_ngrams(["a", "b", "c", "d"], n=3)
        assert result == [("a", "b", "c"), ("b", "c", "d")]

    def test_make_ngrams_short_input(self):
        result = self.hasher.make_ngrams(["a", "b"], n=3)
        assert result == []

    def test_make_ngrams_exact_n(self):
        result = self.hasher.make_ngrams(["a", "b", "c"], n=3)
        assert result == [("a", "b", "c")]


class TestMinHasherCalculate:
    def _make_llil_function(self, num_instructions=10):
        """Create a mock LLIL function with enough instructions."""
        instructions = [
            MockILNode(operation=i % 20) for i in range(num_instructions)
        ]
        bb = MockLLILBasicBlock(instructions)
        return MockLLILFunction([bb])

    def test_calculate_minhash_empty_function(self):
        # Function with < 3 LLIL instructions -> empty list
        func = self._make_llil_function(num_instructions=2)
        hasher = MinHasher(seed=42, il_function=func)
        result = hasher.calculateMinHash()
        assert result == []

    def test_calculate_minhash_deterministic(self):
        func = self._make_llil_function(num_instructions=20)
        h1 = MinHasher(seed=42, il_function=func)
        h2 = MinHasher(seed=42, il_function=func)
        assert h1.calculateMinHash() == h2.calculateMinHash()

    def test_calculate_minhash_length(self):
        func = self._make_llil_function(num_instructions=20)
        hasher = MinHasher(seed=42, il_function=func)
        result = hasher.calculateMinHash()
        assert len(result) == MINHASH_SIGNATURE_LENGTH

    def test_calculate_minhash_value_range(self):
        func = self._make_llil_function(num_instructions=20)
        hasher = MinHasher(seed=42, il_function=func)
        result = hasher.calculateMinHash()
        for val in result:
            assert 0 <= val < 2 ** MINHASH_SIGNATURE_BITS

    def test_shingle_hash_deterministic(self):
        func = self._make_llil_function(num_instructions=5)
        hasher = MinHasher(seed=42, il_function=func)
        shingle = ([1, 2], [3, 4], [5, 6])
        assert hasher.shingle_hash(shingle, 99) == hasher.shingle_hash(shingle, 99)

    def test_seed_reproducibility(self):
        func = self._make_llil_function(num_instructions=20)
        h1 = MinHasher(seed=1, il_function=func)
        h2 = MinHasher(seed=2, il_function=func)
        r1 = h1.calculateMinHash()
        r2 = h2.calculateMinHash()
        # Different seeds should (very likely) produce different results
        assert r1 != r2