diff options
| author | Brian Potchik <brian@vector35.com> | 2019-03-14 17:48:10 -0400 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2019-03-14 17:48:10 -0400 |
| commit | 0b1529934c59645c895590997b919d2f0870f891 (patch) | |
| tree | dff5fcf27377f956625cff7bf61a7456b4237f1b /binaryview.cpp | |
| parent | 902750648579d32cc83fbd91181ecea2c9e0c9e5 (diff) | |
BinaryView API for entropy.
Diffstat (limited to 'binaryview.cpp')
| -rw-r--r-- | binaryview.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/binaryview.cpp b/binaryview.cpp index 690ccee1..b4ca2fd9 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -890,6 +890,24 @@ size_t BinaryView::InsertBuffer(uint64_t offset, const DataBuffer& data) } +vector<float> BinaryView::GetEntropy(uint64_t offset, size_t len, size_t blockSize) +{ + if (!blockSize) + blockSize = len; + + float* entopy = new float[(len / blockSize) + 1]; + len = BNGetEntropy(m_object, offset, len, blockSize, entopy); + + vector<float> result; + result.reserve(len); + for (size_t i = 0; i < len; i++) + result.push_back(entopy[i]); + + delete[] entopy; + return result; +} + + vector<BNModificationStatus> BinaryView::GetModification(uint64_t offset, size_t len) { BNModificationStatus* mod = new BNModificationStatus[len]; |
