Jan Haase

113 papers A 4B 1C 46Misc 1Journal 9Unranked 49
YearRankTypeTitle / Venue / Authors
2025 conf
GeCon
Niklas Schlegel, Silas Della Contrada, Lukas Lange, Marcus Soll, Louis Kobras, Daniel Versick, Jan Haase
2025 conf
exp.at
Mohamed-Kamel Koumenji, Marcus Soll, Louis Kobras, Jan Haase
2025 C conf
EDUCON
Jorge Torres Gómez, Imen Bekkari, Nicolai Spicher, Carmen Peláez-Moreno, Jan Haase, Maurizio Magarini
2024 C conf
IECON
Mohannad Alkhalil, Sulaiman Mohaidat, Juhyun Bak, Kevin James, Xiaoqi Liu, Fadi Alsaleem, Michael Hempel, Hamid Sharif-Kashani, Jan Haase, Mahmoud A. Alahmad
2024 conf
GeCon
Louis Kobras, Jan Haase, Marcus Soll
2024 C conf
EDUCON
Jorge Torres Gómez, Nicolai Spicher, Jan Haase
2023 C conf
IECON
Tim Hottenbacher, Jan Haase
2023 conf
GECon
Jan Haase, Jorge Tomes Gomez, Nicolai Spicher, Andreas Apostolatos, Shaun Kaplan, Claudia-Melania Chituc
2023 C conf
EDUCON
Jorge Torres Gómez, Nicolai Spicher, Jan Haase
2023 conf
ISIE
Jan Haase, Ahmad Almaghrebi, Fares Al Juheshi, Sam Moayedi, Nasser A. Aljuhaishi, Mahmoud A. Alahmad
2022 conf
GeCon
Ines Aubel, Sebastian Zug, André Dietrich, Johannes Nau, Karsten Henke, Pierre Helbing, Detlef Streitferdt, Claudius Terkowsky, Konrad Boettcher, Tobias R. Ortelt, Marcel Schade, Norbert Kockmann, Tobias Haertel, Uwe Wilkesmann, Matthias Finck, Jan Haase, Franziska Herrmann, Louis Kobras, Bernhard Meussen, Marcus Soll, Daniel Versick
2022 C conf
IECON
Jan Haase
2022 C conf
EDUCON
Jan Haase
2022 conf
GeCon
Marcus Soll, Jan Haase, Pierre Helbing, Johannes Nau
2021 C conf
IECON
Dominik Meyer, Jan Haase, Marcel Eckert, Bernd Klauer
2021 conf
ISIE
Stephan Dallmer-Zerbe, Jan Haase
2021 C conf
IECON
Jan Haase
2020 C conf
SCOPES
Thore Kolms, Andreas Waldner, Christine Lang, Philipp Grothe, Jan Haase
2020 conf
ISIE
Philipp Grothe, Jan Haase
2020 C conf
IECON
Sam Moayedi, Ahmad Almaghrebi, Jan Haase, Hiroaki Nishi, Gerhard Zucker, Nasser A. Aljuhaishi, Mahmoud A. Alahmad
2020 C conf
IECON
Thore Kolms, Christine Lang, Andreas Waldner, Philipp Grothe, Jan Haase
2020 C conf
IECON
Marcel Eckert, Jan Haase, Bernd Klauer
2019 conf
ISIE
Dominik Meyer, Marcel Eckert, Bernd Klauer, Jan Haase
2019 conf
ISIE
Philipp Grothe, Jan Haase
2019 C conf
SCOPES
Philipp Grothe, Jan Haase
2018 conf
EWME
Jan Haase
2018 C conf
IECON
Sam Moayedi, Fares Al Juheshi, Ahmad Almaghrebi, Jan Haase, Hiroaki Nishi, Kim Fung Tsang, Mahmoud A. Alahmad
2017 ed.
WISES
Jan Haase
2017 C conf
IECON
Jan Haase, Fares Al Juheshi, Hiroaki Nishi, Joern Ploennigs, Kim Fung Tsang, Nasser A. Aljuhaishi, Mahmoud A. Alahmad
2017 conf
GI-Jahrestagung
Jan Haase, Gerhard Leitner, Raphael Zender
2017 conf
GI-Jahrestagung
Jan Haase
2017 C conf
IECON
Dominik Meyer, Jan Haase, Marcel Eckert, Bernd Klauer
2017 conf
AFRICON
Bernd Klauer, Jan Haase, Dominik Meyer, Marcel Eckert
2016 C conf
INDIN
Dominik Meyer, Jan Haase, Marcel Eckert, Bernd Klauer
2016 C conf
IECON
Dominik Meyer, Jan Haase, Marcel Eckert, Bernd Klauer
2016 conf
GI-Jahrestagung
Jan Haase, Gerhard Leitner, Daniel Versick, Raphael Zender
2016 conf
GI-Jahrestagung
Jan Haase, Dominik Meyer
2016 J jnl
Int. J. Reconfigurable Comput.
Marcel Eckert, Dominik Meyer, Jan Haase, Bernd Klauer
2016 C conf
INDIN
Jan Haase, Mahmoud A. Alahmad, Hiroaki Nishi, Joern Ploennigs, Kim Fung Tsang
2016 conf
ICIT
Jan Haase, Dominik Meyer, Marcel Eckert, Bernd Klauer
2015 C conf
IECON
Jan Haase, Gerhard Zucker, Fares Al Juheshi, Mohannad Khair Allah, Mahmoud A. Alahmad
2015 C conf
IECON
Sachio Godo, Jan Haase, Hiroaki Nishi
2015 C conf
IECON
Dominik Meyer, Jan Haase, Marcel Eckert, Bernd Klauer
2015 C conf
IECON
Usman Habib, Gerhard Zucker, Max Blochle, Florian Judex, Jan Haase
2015 C conf
INDIN
Kengo Okada, Kanae Matsui, Jan Haase, Hiroaki Nishi
2015 C conf
INDIN
Chi Chung Lee, Wah Ching Lee, Haoyuan Cai, Hao Ran Chi, Chung Kit Wu, Jan Haase, Mikael Gidlund
2015 conf
EUROCON
Jan Haase, Athanasios Kakarountas, Manuel Graña, Jesús Fraile-Ardanuy, Carl James Debono, Héctor Quintián, Emilio Corchado
2014 C conf
IECON
Jan Haase, Gerhard Zucker, Mahmoud A. Alahmad
2014 ed.
FDL (Selected Papers)
Jan Haase
2014 conf
ISIE
Joseph Wenninger, Jan Haase
2013 conf
ARCS Workshops
Joseph Wenninger, Jan Haase
2013 C conf
IECON
Michael Rathmair, Jan Haase
2013 C conf
IECON
Bernhard Mahler, Jan Haase
2013 C conf
FDL
Jan Haase, François Pêcheux
2013 C conf
IECON
Yoseba K. Penya, Cruz E. Borges, Jan Haase, Dietmar Bruckner
2012 C conf
IECON
Caglar Tirkaz, Dietmar Bruckner, GuoQing Yin, Jan Haase
2012 J jnl
Elektrotech. Informationstechnik
Dietmar Dietrich, Friederich Kupzog, Jan Haase
2012 C conf
FDL
Clifford Wolf, Johann Glaser, Florian Schupfer, Jan Haase, Christoph Grimm
2012 conf
FDL (Selected Papers)
Slobodanka Tomic, Jan Haase, Goran Lazendic
2012 C conf
IECON
Dietmar Bruckner, Jan Haase, Peter Palensky, Gerhard Zucker
2012 conf
FDL (Selected Papers)
Javier Moreno Molina, Markus Damm, Jan Haase, Edgar Holleis, Christoph Grimm
2012 conf
ISGT Europe
Markus Damm, Milan Lukic, Stefan Mahlknecht, Jan Haase, Christoph Grimm, Veljko Malbasa
2012 C conf
FDL
Javier Moreno, Markus Damm, Jan Haase, Christoph Grimm, Edgar Holleis
2011 conf
AHS
Jiong Ou, Muhammad Farooq, Jan Haase, Christoph Grimm
2011 C conf
FDL
Sumit Adhikari, Christoph Grimm, Jan Haase
2011 conf
EUROCON
Joseph Wenninger, Friedrich Bauer, Jan Haase, Thomas Fischer
2011 conf
ARCS Workshops
Klaus Gravogl, Jan Haase, Christoph Grimm
2011 C conf
FDL
Joseph Wenninger, Javier Moreno, Jan Haase, Christoph Grimm
2011 conf
ARCS Workshops
Mario Lang, Jan Haase, Joseph Wenninger
2011 conf
AFRICON
Javier Moreno, Joseph Wenninger, Jan Haase, Christoph Grimm
2011 C conf
ISCAS
Christian Stoif, Martin Schoeberl, Benito Liccardi, Jan Haase
2011 C conf
DDECS
Sumit Adhikari, Muhammad Farooq, Jan Haase, Christoph Grimm
2011 C conf
ISCAS
Mario Lang, Jan Haase, Christoph Grimm
2011 conf
AFRICON
Joseph Wenninger, Javier Moreno, Jan Haase
2011 J jnl
IEEE Trans. Ind. Informatics
Jan Haase, Javier Moreno Molina, Dietmar Dietrich
2011 conf
ARCS Workshops
Rainer Matischek, Thomas Herndl, Christoph Grimm, Jan Haase
2011 A conf
DATE
Rainer Matischek, Thomas Herndl, Christoph Grimm, Jan Haase
2011 A conf
DATE
Yaseen Zaidi, Christoph Grimm, Jan Haase
2011 J jnl
ACM Trans. Reconfigurable Technol. Syst.
Johann Glaser, Markus Damm, Jan Haase, Christoph Grimm
2011 conf
EUROCON
Friedrich Bauer, Joseph Wenninger, Jan Haase, Thomas Fischer
2010 conf
ARC
Johann Glaser, Markus Damm, Jan Haase, Christoph Grimm
2010 J jnl
Int. J. Parallel Program.
Jan Haase, Andreas Hofmann, Klaus Waldschmidt
2010 C conf
FDL
Peter Brunmayr, Jan Haase, Christoph Grimm
2010 conf
AHS
Jiong Ou, Muhammad Farooq, Jan Haase, Christoph Grimm
2010 conf
CSNDSP
Johann Glaser, Jan Haase, Christoph Grimm
2010 conf
MBMV
Jiong Ou, Peter Brunmayr, Jan Haase, Christoph Grimm
2010 conf
ARCS Workshops
Javier Moreno Molina, Jan Haase, Christoph Grimm
2010 C conf
FDL
Jan Haase, Mario Lang, Christoph Grimm
2010 Misc conf
FIT
Muhammad Farooq, Sumit Adhikari, Jan Haase, Christoph Grimm
2010 conf
ARCS Workshops
Joseph Wenninger, Markus Damm, Javier Moreno, Jan Haase, Christoph Grimm
2010 J jnl
EURASIP J. Embed. Syst.
Yaseen Zaidi, Christoph Grimm, Jan Haase
2010 conf
PATMOS
Jan Haase, Christoph Grimm
2010 conf
AHS
Andreas Hofmann, Klaus Waldschmidt, Jan Haase
2010 A conf
DATE
Markus Damm, Javier Moreno, Jan Haase, Christoph Grimm
2009 conf
BMAS
Yaseen Zaidi, Christoph Grimm, Jan Haase
2009 C conf
FDL
Yaseen Zaidi, Christoph Grimm, Jan Haase
2009 conf
Asia International Conference on Modelling and Simulation
Peter Brunmayr, Jan Haase, Florian Schupfer
2009 C conf
FDL
Jan Haase, Markus Damm, Johann Glaser, Javier Moreno, Christoph Grimm
2008 J jnl
EURASIP J. Embed. Syst.
Markus Damm, Jan Haase, Christoph Grimm, Fernando Herrera, Eugenio Villar
2008 conf
BMAS
Markus Damm, Jan Haase, Christoph Grimm
2008 C conf
FDL
Markus Damm, Christoph Grimm, Jan Haase, Andreas Herrholz, Wolfgang Nebel
2007 C conf
FDL
Fernando Herrera, Eugenio Villar, Christoph Grimm, Markus Damm, Jan Haase
2007 J jnl
J. Syst. Archit.
Klaus Waldschmidt, Jan Haase, Werner Grass, Bernhard Sick
2007
Jan Haase
2007 B conf
FPL
Andreas Herrholz, Frank Oppenheimer, Philipp A. Hartmann, Andreas Schallenberg, Wolfgang Nebel, Christoph Grimm, Markus Damm, Jan Haase, Florian Brame, Fernando Herrera, Eugenio Villar, Ingo Sander, Axel Jantsch, Anne-Marie Fouilliart, Marcos Martínez
2006 conf
Dynamically Reconfigurable Architectures
Klaus Waldschmidt, Jan Haase, Andreas Hofmann, Markus Damm, Dennis Hauser
2006 conf
DIPES
Jan Haase, Markus Damm, Dennis Hauser, Klaus Waldschmidt
2006 conf
BICC
Jan Haase, Andreas Hofmann, Klaus Waldschmidt
2005 J jnl
it Inf. Technol.
Jan Haase, Frank Eschmann, Klaus Waldschmidt
2005 A conf
IPDPS
Jan Haase, Frank Eschmann, Klaus Waldschmidt
2005 conf
Parallel and Distributed Computing and Networks
Jan Haase, Frank Eschmann, Klaus Waldschmidt
2004 conf
GI Jahrestagung (2)
Jan Haase, Frank Eschmann
2004 conf
ARCS
Jan Haase, Frank Eschmann, Bernd Klauer, Klaus Waldschmidt
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