# EnCoD: Distinguishing Compressed and Encrypted File Fragments

Source: [EnCoD: Distinguishing Compressed and Encrypted File Fragments](<https://www.sota2.com/research/paper/68fa68811e209131cea1c7a2>)

Collection index: [llms.txt](<https://www.sota2.com/research/llms.txt>)

Data updated: 2025-10-25T22:38:59.898Z

Authors: Fabio De Gaspari, Dorjan Hitaj, Giulio Pagnotta, Lorenzo De Carli, Luigi V. Mancini

Published: 2020-10-15T13:55:55.000Z

## Abstract

Reliable identification of encrypted file fragments is a requirement for several security applications, including ransomware detection, digital forensics, and traffic analysis. A popular approach consists of estimating high entropy as a proxy for randomness. However, many modern content types (e.g. office documents, media files, etc.) are highly compressed for storage and transmission efficiency. Compression algorithms also output high-entropy data, thus reducing the accuracy of entropy-based encryption detectors. Over the years, a variety of approaches have been proposed to distinguish encrypted file fragments from high-entropy compressed fragments. However, these approaches are typically only evaluated over a few, select data types and fragment sizes, which makes a fair assessment of their practical applicability impossible. This paper aims to close this gap by comparing existing statistical tests on a large, standardized dataset. Our results show that current approaches cannot reliably tell apart encryption and compression, even for large fragment sizes. To address this issue, we design EnCoD, a learning-based classifier which can reliably distinguish compressed and encrypted data, starting with fragments as small as 512 bytes. We evaluate EnCoD against current approaches over a large dataset of different data types, showing that it outperforms current state-of-the-art for most considered fragment sizes and data types.

## Recorded benchmark results

A research result applies to its stated dataset, split, metric and evaluation configuration. Compare like-for-like settings, preserve the metric's unit and direction, and distinguish paper-reported results from independent reproduction. The best result recorded here is not a claim of exhaustive, current global coverage.

- [Binary Classification on File Fragment Dataset 2KB (test)](<https://www.sota2.com/research/sota/binary-classification-on-file-fragment-dataset-2kb-test.md>): Binary Classification; File Fragment Dataset 2KB (test); Accuracy (bz2): 97.8.

## Original sources and implementation

[Original paper](<https://arxiv.org/abs/2010.07754>)

[PDF](<https://arxiv.org/pdf/2010.07754.pdf>)
