summaryrefslogtreecommitdiff
path: root/examples/triage/entropy.h
diff options
context:
space:
mode:
authorJordan Wiens <github@psifertex.com>2026-01-01 12:21:22 -0500
committerJordan Wiens <github@psifertex.com>2026-01-01 12:21:22 -0500
commit37a0604d805991b85a0590279ad993a19ddee7bb (patch)
treefa8054497a4761f134ab5b537dfb0dbfc9a64f32 /examples/triage/entropy.h
parent2448131059638409902821451115872036230328 (diff)
add whole-file entropy calculation to triage
Diffstat (limited to 'examples/triage/entropy.h')
-rw-r--r--examples/triage/entropy.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/triage/entropy.h b/examples/triage/entropy.h
index 821dfb7b..bd50081d 100644
--- a/examples/triage/entropy.h
+++ b/examples/triage/entropy.h
@@ -3,6 +3,7 @@
#include <QtWidgets/QWidget>
#include <QtGui/QImage>
#include <thread>
+#include <mutex>
#include "uitypes.h"
@@ -13,6 +14,9 @@ class EntropyThread
size_t m_blockSize;
bool m_updated, m_running;
std::thread m_thread;
+ double m_averageEntropy;
+ int m_sampleCount;
+ mutable std::mutex m_mutex;
public:
EntropyThread(BinaryViewRef data, size_t blockSize, QImage* image);
@@ -21,6 +25,7 @@ class EntropyThread
void Run();
bool IsUpdated() { return m_updated; }
void ResetUpdated() { m_updated = false; }
+ double GetAverageEntropy() const;
};
@@ -28,6 +33,8 @@ class TriageView;
class EntropyWidget : public QWidget
{
+ Q_OBJECT
+
TriageView* m_view;
BinaryViewRef m_data, m_rawData;
size_t m_blockSize;
@@ -40,6 +47,10 @@ class EntropyWidget : public QWidget
virtual ~EntropyWidget();
virtual QSize sizeHint() const override;
+ double getAverageEntropy() const;
+
+ Q_SIGNALS:
+ void entropyUpdated(double avgEntropy);
protected:
virtual void paintEvent(QPaintEvent* event) override;