James Joshi

103 papers A* 1A 5B 7C 14Misc 5Journal 49Unranked 20
YearRankTypeTitle / Venue / Authors
2026 J jnl
CoRR
M. Amin Rahimian, Benjamin Panny, James Joshi
2025 J jnl
CoRR
Liou Tang, James Joshi, Ashish Kundu
2025 J jnl
CoRR
Peilin He, Liou Tang, M. Amin Rahimian, James Joshi
2025 J jnl
CoRR
Runhua Xu, Shiqi Gao, Chao Li, James Joshi, Jianxin Li
2025 conf
Deep-Breath@MICCAI
Zhengbo Zhou, Degan Hao, Dooman Arefan, Margarita L. Zuley, Jules H. Sumkin, Lars Grimm, James Joshi, Shandong Wu
2025 conf
TPS-ISA
Peilin He, James Joshi
2024 A* conf
NeurIPS
Runhua Xu, Shiqi Gao, Chao Li, James Joshi, Jianxin Li
2024 ed.
CODASPY
James Joshi, Jaideep Vaidya, Haya Schulmann
2024 conf
TPS-ISA
Maryam Aldairi, James Joshi
2024 conf
TPS-ISA
Liou Tang, James Joshi
2023 J jnl
IEEE Trans. Dependable Secur. Comput.
Runhua Xu, Chao Li, James Joshi
2023 conf
TPS-ISA
Galen Harrison, Przemyslaw J. Porebski, Jiangzhuo Chen, Mandy L. Wilson, Henning S. Mortveit, Parantapa Bhattacharya, Dawen Xie, Stefan Hoops, Anil Vullikanti, Li Xiong, James Joshi, Madhav V. Marathe
2022 J jnl
IEEE Trans. Dependable Secur. Comput.
Leila Karimi, Maryam Aldairi, James Joshi, Mai Abdelhakim
2022 J jnl
IEEE Trans. Serv. Comput.
Mei-Ling Shyu, Surya Nepal, Valérie Issarny, James Joshi
2022 J jnl
IEEE Trans. Dependable Secur. Comput.
Runhua Xu, James Joshi, Chao Li
2021 J jnl
CoRR
Leila Karimi, Mai Abdelhakim, James Joshi
2021 J jnl
IEEE Trans. Dependable Secur. Comput.
Runhua Xu, James Joshi, Prashant Krishnamurthy
2021 A conf
SIGCSE
Nigamanth Sridhar, Li Yang, James Joshi, Victor Piotrowski
2021 conf
AISec@CCS
Runhua Xu, Nathalie Baracaldo, Yi Zhou, Ali Anwar, James Joshi, Heiko Ludwig
2021 J jnl
CoRR
Runhua Xu, Nathalie Baracaldo, Yi Zhou, Ali Anwar, James Joshi, Heiko Ludwig
2021 J jnl
CoRR
Runhua Xu, Nathalie Baracaldo, James Joshi
2021 J jnl
CoRR
Runhua Xu, Chao Li, James Joshi
2020 J jnl
Comput. Secur.
Nuray Baltaci Akhuseyinoglu, James Joshi
2020 J jnl
CoRR
Leila Karimi, Maryam Aldairi, James Joshi, Mai Abdelhakim
2020 J jnl
IEEE Trans. Serv. Comput.
James Joshi
2020 J jnl
CoRR
Runhua Xu, James Joshi, Chao Li
2020 conf
TPS-ISA
Runhua Xu, James Joshi
2020 J jnl
CoRR
Runhua Xu, James Joshi
2020 J jnl
ACM Trans. Internet Techn.
Runhua Xu, James Joshi
2019 Misc conf
IRI
Maryam Aldairi, Leila Karimi, James Joshi
2019 C ed.
ICBC
James Joshi, Surya Nepal, Qi Zhang, Liang-Jie Zhang
2019 J jnl
IEEE Trans. Serv. Comput.
James Joshi
2019 J jnl
IEEE Trans. Dependable Secur. Comput.
Nathalie Baracaldo, Balaji Palanisamy, James Joshi
2019 J jnl
ACM Trans. Internet Techn.
Schahram Dustdar, Surya Nepal, James Joshi
2018 conf
IEEE BigData
Leila Karimi, James Joshi
2018 J jnl
Computer
James Joshi
2018 conf
TrustCom/BigDataSE
Runhua Xu, Balaji Palanisamy, James Joshi
2018 conf
CIC
LeRoy Carr III, Anthony Newtson, James Joshi
2017 conf
CIC
Nuray Baltaci Akhuseyinoglu, James Joshi
2017 conf
BigData Congress
Chao Li, Balaji Palanisamy, James Joshi
2017 J jnl
IEEE Trans. Serv. Comput.
James Joshi
2017 conf
Q2SWinet@MSWiM
Maryam Karimi, Prashant Krishnamurthy, James Joshi, David Tipper
2017 conf
CIC
Leila Karimi, James Joshi
2016 ed.
IEEE BigData
James Joshi, George Karypis, Ling Liu, Xiaohua Hu, Ronay Ak, Yinglong Xia, Weijia Xu, Aki-Hiro Sato, Sudarsan Rachuri, Lyle H. Ungar, Philip S. Yu, Rama Govindaraju, Toyotaro Suzumura
2016 conf
CIC
Leila Karimi, Balaji Palanisamy, James Joshi
2016 A conf
ICWS
Chao Li, Balaji Palanisamy, James Joshi
2016 conf
CIC
Yue Su, Ziyi Lan, Yu-Ru Lin, Louise K. Comfort, James Joshi
2015 J jnl
Int. J. Semantic Comput.
Mei-Ling Shyu, James Joshi, Qiong Liu
2014 J jnl
Comput. Secur.
Lakshmish Ramaswamy, Barbara Carminati, Lujo Bauer, Dongwan Shin, James Joshi, Calton Pu, Dimitris Gritzalis
2014 J jnl
Int. J. Cooperative Inf. Syst.
Barbara Carminati, Lakshmish Ramaswamy, Anna Cinzia Squicciarini, James Joshi, Calton Pu
2014 Misc ed.
IRI
James Joshi, Elisa Bertino, Bhavani Thuraisingham, Ling Liu
2014 J jnl
EAI Endorsed Trans. Collab. Comput.
James Joshi, Calton Pu
2013 B conf
ASONAM
Xuelian Long, James Joshi
2013 J jnl
IEEE Commun. Surv. Tutorials
Saman Taghavi Zargar, James Joshi, David Tipper
2013 J jnl
Comput. Secur.
Nathalie Baracaldo, James Joshi
2013 C conf
SACMAT
Nathalie Baracaldo, James Joshi
2013 J jnl
Mob. Networks Appl.
James Caverlee, Calton Pu, Dimitrios Georgakopoulos, James Joshi
2013 A conf
AsiaCCS
Amirreza Masoumzadeh, James Joshi
2013 J jnl
Trans. Data Priv.
Amirreza Masoumzadeh, James Joshi
2013 B conf
GLOBECOM
Xuelian Long, Lei Jin, James Joshi
2013 C conf
CollaborateCom
Xuelian Long, Lei Jin, James Joshi
2012 C ed.
CollaborateCom
Calton Pu, James Joshi, Surya Nepal
2012 C conf
SACMAT
Nathalie Baracaldo, James Joshi
2012 J jnl
Mob. Networks Appl.
Songqing Chen, Le Gruenwald, James Joshi, Karl Aberer
2012 J jnl
Mob. Networks Appl.
James Joshi, Elisa Bertino, Calton Pu, Heri Ramampiaro
2012 J jnl
Mob. Networks Appl.
Weisong Shi, James Joshi, Tao Zhang, Eun K. Park, Juan Quemada
2012 Misc conf
UbiComp
Xuelian Long, Lei Jin, James Joshi
2012 Misc ed.
IRI
Chengcui Zhang, James Joshi, Elisa Bertino, Bhavani Thuraisingham
2012 C conf
CollaborateCom
Barbara Carminati, Lakshmish Ramaswamy, Calton Pu, James Joshi
2012 J jnl
IEEE Trans. Dependable Secur. Comput.
Amirreza Masoumzadeh, James Joshi
2011 B conf
NSS
Nathalie Baracaldo, Amirreza Masoumzadeh, James Joshi
2011 conf
ANT/MobiWIS
Amirreza Masoumzadeh, James Joshi
2011 J jnl
J. Inf. Knowl. Manag.
Xuelian Long, James Joshi
2011 J jnl
Comput. Secur.
Dimitris Gritzalis, James Joshi
2011 J jnl
ACM Trans. Inf. Syst. Secur.
James Joshi, Barbara Carminati
2011 J jnl
Int. J. Inf. Priv. Secur. Integr.
Amirreza Masoumzadeh, James Joshi
2010 Misc conf
IRI
Xuelian Long, James Joshi
2010 conf
ICC
Xuelian Long, James Joshi
2010 C conf
CollaborateCom
Karl Aberer, James Joshi
2010 C conf
CollaborateCom
Amirreza Masoumzadeh, James Joshi
2010 C ed.
CollaborateCom
Karl Aberer, James Joshi
2009 C ed.
SACMAT
Barbara Carminati, James Joshi
2009 conf
GIS
Amirreza Masoumzadeh, James Joshi, Hassan A. Karimi
2008 B conf
COMPSAC
Michael Jiang, James Joshi
2008 B conf
COMPSAC
Michael Jiang, James Joshi
2005 J jnl
IEEE Trans. Knowl. Data Eng.
James Joshi, Elisa Bertino, Usman Latif, Arif Ghafoor
2005 conf
WORDS
Basit Shafiq, Ammar Masood, James Joshi, Arif Ghafoor
2005 J jnl
IEEE Trans. Dependable Secur. Comput.
James Joshi, Elisa Bertino, Arif Ghafoor
2005 J jnl
IEEE Trans. Knowl. Data Eng.
Basit Shafiq, James Joshi, Elisa Bertino, Arif Ghafoor
2005 J jnl
ACM Trans. Inf. Syst. Secur.
Rafae Bhatti, Arif Ghafoor, Elisa Bertino, James Joshi
2005 J jnl
ACM Trans. Inf. Syst. Secur.
Rafae Bhatti, Basit Shafiq, Elisa Bertino, Arif Ghafoor, James Joshi
2004 J jnl
IEEE Internet Comput.
James Joshi, Rafae Bhatti, Elisa Bertino, Arif Ghafoor
2004 C conf
SACMAT
Elisa Bertino, Bruno Crispo, James Joshi, Wengliang (Kevin) Du, Ravi S. Sandhu
2004 C conf
SACMAT
Rafae Bhatti, James Joshi, Elisa Bertino, Arif Ghafoor
2004 J jnl
Computer
Rafae Bhatti, Elisa Bertino, Arif Ghafoor, James Joshi
2003 A conf
ICWS
Rafae Bhatti, James Joshi, Elisa Bertino, Arif Ghafoor
2003 C conf
SACMAT
James Joshi, Basit Shafiq, Arif Ghafoor, Elisa Bertino
2002 B conf
COMPSAC
James Joshi, Elisa Bertino, Arif Ghafoor
2002 C conf
SACMAT
James Joshi, Elisa Bertino, Arif Ghafoor
2001 J jnl
Computer
James Joshi, Arif Ghafoor, Walid G. Aref, Eugene H. Spafford
2001 J jnl
Commun. ACM
James Joshi, Walid G. Aref, Arif Ghafoor, Eugene H. Spafford
2000 A conf
IEEE International Conference on Multimedia and Expo (I)
James Joshi, Arif Ghafoor
1998 B conf
SRDS
Sahra Sedigh, James Joshi, Ahmed R. Bashandy, Arif Ghafoor
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