Calculates the Shannon entropy of a byte range.
Complexity: O(n) time, O(1) additional space (256 fixed counters).
The complete file buffer
Range to calculate (start, end, length)
If true, caches results for repeated calls
EntropyResult with entropy, classification and statistics
const result = shannonEntropy(buffer, Range.create(Offset.create(0), Offset.create(1023)));console.log(result.entropy); // → 7.94console.log(result.classification); // → "encrypted" Copy
const result = shannonEntropy(buffer, Range.create(Offset.create(0), Offset.create(1023)));console.log(result.entropy); // → 7.94console.log(result.classification); // → "encrypted"
Calculates the Shannon entropy of a byte range.
Complexity: O(n) time, O(1) additional space (256 fixed counters).