Haitham M. Alzoubi

63 papers Journal 6Unranked 27
YearRankTypeTitle / Venue / Authors
2024 conf
ICCR
Samer Hamadneh, Muhammad Turki Alshurideh, Enass Khalil Alquqa, Amer Hani Al-Kassem, Kakul Agha, Haitham M. Alzoubi
2024 conf
ICCR
Muhammad Turki Alshurideh, Bilal Zakarneh, Samer Hamadneh, Gouher Ahmed, Channaganu Paramaiah, Haitham M. Alzoubi
2024 conf
ICCR
Beenish Shameem, Pranav Kumar, Anu Vij, Mohit Vij, Sultan Al Shehri Vij, Haitham M. Alzoubi
2024 conf
ICCR
Riktesh Srivastava, Mohd Abu Faiz, Turki Al Masaeid, Mohammad Inairat, Haitham M. Alzoubi
2024 conf
ICCR
Raneem Jaber, Mohamad A. Alnuaimi, Haitham M. Alzoubi, Osama A. Thawabeh
2024 conf
ICCR
Barween Al Kurdi, Muhammad Turki Alshurideh, Samer Hamadneh, Deepak Kalra, Sunita Marwaha, Haitham M. Alzoubi
2024 conf
ICCR
Mohamed Dawood Shamout, Haitham M. Alzoubi, Hamzah Elrehail, Rania Itani, Anwar Al-Gasaymeh, Maged Farouk
2024 conf
ICCR
Enass Khalil Alquqa, Muhammad Turki Alshurideh, Jamil H. Alalami, Rahul Sharma, Robinson Joseph, Haitham M. Alzoubi
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Abhilash J. Varma, Nasser Taleb, Raed A. Said, Taher M. Ghazal, Munir Ahmad, Haitham M. Alzoubi, Muhammad Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Mounir El Khatib, Alia Mahmood, Amani Al Azizi, Ayesha Al Marzooqi, Khalil Al Abdooli, Saeed Al Marzooqi, Sumaya Al Jasmi, Haitham M. Alzoubi, Muhammad Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Amber Aziz, Muhammad Nawaz Brohi, Tariq Rahim Soomro, Taher M. Ghazal, Haitham M. Alzoubi, Muhammad Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Taher M. Ghazal, Mohammad Kamrul Hasan, Siti Norul Huda Sheikh Abdullah, Khairul Azmi Abu Bakar, Nasser Taleb, Nidal A. Al-Dmour, Eiad Yafi, Ritu Chauhan, Haitham M. Alzoubi, Muhammad Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Nasser Taleb, Nidal A. Al-Dmour, Ghassan F. Issa, Tamer Mohamed Abdellatif, Haitham M. Alzoubi, Muhammad Alshurideh, Mohammed Salahat
2023 J jnl
Int. J. Inf. Manag. Data Insights
Naveed Iqbal Chaudhry, Shafique Ur Rehman, Hamzah Elrehail, Turki Fahed Al Masaeid, Raid Al-Adaileh, Haitham M. Alzoubi
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Nidal A. Al-Dmour, Raed A. Said, Haitham M. Alzoubi, Muhammad Alshurideh, Liaqat Ali
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Mounir El Khatib, Fatma Beshwari, Maryam Beshwari, Ayesha Beshwari, Haitham M. Alzoubi, Muhammad Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Mounir El Khatib, Fatma Beshwari, Maryam Beshwari, Ayesha Beshwari, Haitham M. Alzoubi, Muhammad Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Taher M. Ghazal, Nidal A. Al-Dmour, Raed A. Said, Alireza Omidvar, Urooj Yousuf Khan, Tariq Rahim Soomro, Haitham M. Alzoubi, Muhammad Alshurideh, Tamer Mohamed Abdellatif, Abdullah Moubayed, Liaqat Ali
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Mohammed Salahat, Nidal A. Al-Dmour, Raed A. Said, Haitham M. Alzoubi, Muhammad Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Raed A. Said, Nidal A. Al-Dmour, Mohammed Salahat, Ghassan F. Issa, Haitham M. Alzoubi, Muhammad Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Khai Loon Lee, Gusman Nawanir, Jack Kie Cheng, Haitham M. Alzoubi, Muhammad Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Mounir El Khatib, Alaa Al-Shalabi, Ali Alamim, Hanadi Alblooshi, Shahla Alhosani, Elham Al-Kaabi, Haitham M. Alzoubi, Muhammad Alshurideh
2023 conf
ICAIC
Elham Abdulwahab Anaam, Mohammad Kamrul Hasan, Taher M. Ghazal, Su-Cheng Haw, Haitham M. Alzoubi, Muhammad Turki Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Ismail Ali Al Blooshi, Abdulazez Salem Alamim, Raed A. Said, Nasser Taleb, Taher M. Ghazal, Munir Ahmad, Haitham M. Alzoubi, Muhammad Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Mounir El Khatib, Ahmed Al-Nakeeb, Abdulla AlKetbi, Ayesha Al Hashemi, Fatma Mustafawi, Roudha Almansoori, Shamma Alteneiji, Haitham M. Alzoubi, Muhammad Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Nidal A. Al-Dmour, Liaqat Ali, Mohammed Salahat, Haitham M. Alzoubi, Muhammad Alshurideh, Zakariya Chabani
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Taher M. Ghazal, Mohammad Kamrul Hasan, Haitham M. Alzoubi, Muhammad Alshurideh, Munir Ahmad, Syed Shehryar Akbar
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Raed A. Said, Nidal A. Al-Dmour, Liaqat Ali, Haitham M. Alzoubi, Muhammad Alshurideh, Mohammed Salahat
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Taher M. Ghazal, Mohammad Kamrul Hasan, Munir Ahmad, Haitham M. Alzoubi, Muhammad Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Taher M. Ghazal, Mohammad Kamrul Hasan, Siti Norul Huda Sheikh Abdullah, Khairul Azmi Abu Bakar, Nidal A. Al-Dmour, Raed A. Said, Tamer Mohamed Abdellatif, Abdallah Moubayed, Haitham M. Alzoubi, Muhammad Alshurideh, Waleed Alomoush
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Muhammad Arshad, Muhammad Nawaz Brohi, Tariq Rahim Soomro, Taher M. Ghazal, Haitham M. Alzoubi, Muhammad Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Moattar Farrukh, Tariq Rahim Soomro, Taher M. Ghazal, Haitham M. Alzoubi, Muhammad Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Mounir El Khatib, Moza Abdalla Al Shamsi, Khalid Al Buraimi, Fatima Al Mansouri, Haitham M. Alzoubi, Muhammad Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Mounir El Khatib, Haitham M. Alzoubi, Muhammad Alshurideh, Ali A. Alzoubi
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Wan Nadiah Mohd Nadzri, Azreen Jihan Che Hashim, Muhammad Majid, Nur Aina Abdul Jalil, Haitham M. Alzoubi, Muhammad T. Alshurideh
2023 book
Muhammad Alshurideh, Barween Hikmat Al Kurdi, Ra'ed Masa'deh, Haitham M. Alzoubi, Said A. Salloum
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Mounir El Khatib, Ahmad Ankit, Ishaq Al Ameeri, Hamad Al Zaabi, Rehab Al Marqab, Haitham M. Alzoubi, Muhammad Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Mounir El Khatib, Khalil Al Abdooli, Rashid Alhammadi, Fatma Alshamsi, Najma Abdulla, Amena Al Hammadi, Haitham M. Alzoubi, Muhammad Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Mounir El Khatib, Hamda Al Rais, Hessa Al Rais, Khawla AlShamsi, Latifa Alketbi, Reem AlBanna, Haitham M. Alzoubi, Muhammad Alshurideh
2023 ch.
The Effect of Information Technology on Business and Marketing Intelligence Systems
Mounir El Khatib, Amna Obaid, Fatima Al Mehyas, Fatma Ali Al Ali, Jawahir Abughazyain, Kayriya Alshehhi, Haitham M. Alzoubi, Muhammad Alshurideh
2023 conf
ICAIC
Elham Anaam, Taher M. Ghazal, Su-Cheng Haw, Haitham M. Alzoubi, Muhammad Turki Alshurideh, Abdullah Al Mamun
2022 conf
ICCR
Muhammad Turki Alshurideh, Bader Y. Obeidat, Vorobeva Victoria, Haitham M. Alzoubi, Areej Fatima, Amna Ilyas, Iqra Rustam
2022 conf
ICCR
Neyara Radwan, Haitham M. Alzoubi, Nizar Sahawneh, Areej Fatima, Abdur Rehman, Shan Khan
2022 conf
ICCR
Haitham M. Alzoubi, Nizar Sahawneh, Ahmad Qasim Mohammad AlHamad, Umar Malik, Ameer Majid, Ayesha Atta
2022 conf
RIVF
Asif Khan, Mohammad Kamrul Hasan, Taher M. Ghazal, Shayla Islam, Haitham M. Alzoubi, Umi Asma' Mokhtar, Rizwan Alam, Munir Ahmad
2022 conf
ICAIC
Haitham M. Alzoubi, Taher M. Ghazal, Mohammad Kamrul Hasan, Asma Alketbi, Rukshanda Kamran, Nidal A. Al-Dmour, Shayla Islam
2022 J jnl
Intell. Autom. Soft Comput.
Naeem Ali, Taher M. Ghazal, Alia Ahmed, Sagheer Abbas, M. A. Khan, Haitham M. Alzoubi, Umar Farooq, Munir Ahmad, Muhammad Adnan Khan
2022 conf
ICAIC
Taher M. Ghazal, Mohammad Kamrul Hasan, Haitham M. Alzoubi, Mohammed Al Hmmadi, Nidal A. Al-Dmour, Shayla Islam, Rukshanda Kamran, Beenu Mago
2022 J jnl
Int. J. Serv. Sci. Manag. Eng. Technol.
Haitham M. Alzoubi, Hamzah Elrehail, Jalal Rajeh Hanaysha, Anwar Al-Gasaymeh, Raid Al-Adaileh
2022 conf
ICCR
Atif Ali, Yasir Khan Jadoon, Zulqarnain Farid, Munir Ahmad, Naseem Abidi, Haitham M. Alzoubi, Ali A. Alzoubi
2021 conf
AICV
Taher M. Ghazal, Muhammad T. Alshurideh, Haitham M. Alzoubi
2021 conf
AICV
Ala'a Yahya Ahmad, Muhammad Turki Alshurideh, Barween H. Al Kurdi, Haitham M. Alzoubi
2021 conf
AICV
Mohammed T. Nuseir, Barween H. Al Kurdi, Muhammad T. Alshurideh, Haitham M. Alzoubi
2021 conf
AICV
Rasha M. Al Batayneh, Nasser Taleb, Raed A. Said, Muhammad Turki Alshurideh, Taher M. Ghazal, Haitham M. Alzoubi
2021 J jnl
Int. J. Serv. Sci. Manag. Eng. Technol.
Jalal Rajeh Hanaysha, Mohammed Emad Al Shaikh, Haitham M. Alzoubi
2021 conf
AICV
Petr Svoboda, Taher M. Ghazal, Mohammed A. M. Afifi, Deepak Kalra, Muhammad T. Alshurideh, Haitham M. Alzoubi
2021 conf
AICV
Haitham M. Alzoubi, Muhammad Alshurideh, Taher M. Ghazal
2021 J jnl
Future Internet
Taher M. Ghazal, Mohammad Kamrul Hasan, Muhammad Turki Alshurideh, Haitham M. Alzoubi, Munir Ahmad, Syed Shehryar Akbar, Barween Al Kurdi, Iman A. Akour
2021 conf
AICV
Kakul Agha, Haitham M. Alzoubi, Muhammad Turki Alshurideh
2021 J jnl
Intell. Autom. Soft Comput.
Naeem Ali, Alia Ahmed, Leena Anum, Taher M. Ghazal, Sagheer Abbas, Muhammad Adnan Khan, Haitham M. Alzoubi, Munir Ahmad
2021 conf
AICV
Khaled Al Shebli, Raed A. Said, Nasser Taleb, Taher M. Ghazal, Muhammad Turki Alshurideh, Haitham M. Alzoubi
2021 conf
AICV
Rabab Naqvi, Tariq Rahim Soomro, Haitham M. Alzoubi, Taher M. Ghazal, Muhammad Turki Alshurideh
2021 conf
AICV
Shanmugan Joghee, Haitham M. Alzoubi, Muhammad Alshurideh, Barween Al Kurdi
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