diff options
Diffstat (limited to 'src/utils/util.cpp')
-rw-r--r-- | src/utils/util.cpp | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/src/utils/util.cpp b/src/utils/util.cpp index af1c62ebd..f8b98fcb8 100644 --- a/src/utils/util.cpp +++ b/src/utils/util.cpp @@ -64,36 +64,4 @@ u32bit dl_work_factor(u32bit bits) #endif } -/************************************************* -* Estimate the entropy of the buffer * -*************************************************/ -u32bit entropy_estimate(const byte buffer[], u32bit length) - { - if(length <= 4) - return 0; - - u32bit estimate = 0; - byte last = 0, last_delta = 0, last_delta2 = 0; - - for(u32bit j = 0; j != length; ++j) - { - byte delta = last ^ buffer[j]; - last = buffer[j]; - - byte delta2 = delta ^ last_delta; - last_delta = delta; - - byte delta3 = delta2 ^ last_delta2; - last_delta2 = delta2; - - byte min_delta = delta; - if(min_delta > delta2) min_delta = delta2; - if(min_delta > delta3) min_delta = delta3; - - estimate += hamming_weight(min_delta); - } - - return (estimate / 2); - } - } |