bcsd-benchmark
收藏资源简介:
BCSD数据集(Binary Code Similarity Detection)是一个专门用于二进制代码相似性检测的资源。它包含从AtCoder、LeetCode和Rosetta Code平台收集的5,212个问题对应的11,639个C/C++源程序,这些程序在x86-64架构上使用GCC和Clang编译器,并应用了五种优化级别(O0、O1、O2、O3、Os)进行编译。数据集提供了编译后的ELF二进制文件(共114,532个文件)、使用angr工具生成的线性反汇编输出(每个二进制对应一个JSON文件)、为jTrans模型准备的基本块反汇编数据,以及预计算的函数嵌入向量(存储为.npy格式,支持baseline、palmtree、refuse、jtrans等方法,嵌入维度分别为16、128、128、768)。此外,数据集还包括原始源代码文件(涵盖C、C++、Go和Rust语言),但当前版本仅编译了C和C++程序,Go和Rust仅以源代码形式提供。文件按照统一的路径结构组织,便于按编译器、架构、优化级别、数据集来源、问题名称和语言实现进行索引。该数据集主要用于二进制代码相似性检测、逆向工程和反汇编分析等任务,用户可直接加载预计算的嵌入向量进行实验。需要注意的是,数据集仅支持x86-64架构,且使用源代码时应遵守原始平台的条款。
The BCSD dataset (Binary Code Similarity Detection) is a resource specifically designed for binary code similarity detection. It includes 11,639 C/C++ source programs corresponding to 5,212 problems collected from the AtCoder, LeetCode, and Rosetta Code platforms. These programs are compiled on the x86-64 architecture using GCC and Clang compilers with five optimization levels (O0, O1, O2, O3, Os). The dataset provides compiled ELF binary files (totaling 114,532 files), linear disassembly outputs generated using the angr tool (each binary corresponds to a JSON file), basic block disassembly data prepared for the jTrans model, and pre-computed function embedding vectors (stored in .npy format, supporting methods such as baseline, palmtree, refuse, and jtrans with embedding dimensions of 16, 128, 128, and 768, respectively). Additionally, the dataset includes original source code files (covering C, C++, Go, and Rust languages), but the current version only compiles C and C++ programs, with Go and Rust provided only in source code form. Files are organized in a unified path structure for easy indexing by compiler, architecture, optimization level, dataset source, problem name, and language implementation. This dataset is primarily used for tasks such as binary code similarity detection, reverse engineering, and disassembly analysis, allowing users to directly load pre-computed embedding vectors for experiments. It should be noted that the dataset only supports the x86-64 architecture, and the use of source code must comply with the terms of the original platforms.
BCSD 数据集概述
名称:BCSD (Binary Code Similarity Detection) 数据集
许可协议:CC-BY-4.0
语言:英语
任务类型:特征提取
标签:二进制代码相似性检测、逆向工程、反汇编、x86-64
数据集规模
- 包含 11,639 个源程序,来源于 5,212 个编程问题(来自 AtCoder、LeetCode、Rosetta Code)
- 共编译生成 114,532 个 ELF 二进制文件
- 数据集大小范围:100K < n < 1M
数据内容与文件结构
| 文件 | 大小 | 说明 |
|---|---|---|
sources.tar.zst |
22 MB | 原始源代码文件 (C, C++, Go, Rust) |
binaries.tar.zst |
1.85 GB | 已编译的 ELF 二进制文件 (114,532 个) |
disasm.tar.zst |
47 MB | 线性反汇编结果 (使用 angr),每个二进制对应一个 JSON 文件 |
disasm_jtrans.tar.zst |
99 MB | 适用于 jTrans 模型的基本块反汇编数据 |
embeddings.tar.zst |
538 MB | 每个函数的嵌入向量文件 (.npy 格式) |
编译配置
- 编译器:GCC 和 Clang
- 优化级别:O0, O1, O2, O3, Os
- 架构:x86-64
路径结构
压缩包 (binaries, disasm, disasm_jtrans, embeddings) 遵循统一的路径布局:
<compiler>/<arch>/<optim>/<dataset>/<problem>/<Lang>__impl_NN
示例:clang/x86_64/Os/rosetta_code/binary_digits/Cpp__impl_01
源代码路径格式:
sources/<dataset>/<problem>/<Lang>/impl_NN.ext
嵌入向量维度
baseline: 16维palmtree/refuse: 128维jtrans: 768维- 文件
embeddings/index.json记录了每个函数的嵌入路径映射
使用说明
- 解压需使用 zstd 工具
- 可通过 Hugging Face Hub 命令行工具下载
- 反汇编 JSON 文件中包含函数名称、指令数量及每条指令的操作码和操作数
注意事项
- 当前版本仅包含 C 和 C++ 的编译结果,Go 和 Rust 代码仅出现在源代码中
- 仅支持 x86-64 架构
- 源程序来自 AtCoder、LeetCode 和 Rosetta Code,复用需遵守相应条款




