mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-10 16:25:01 -04:00
Added a form of scoring mechanism for entropy
This commit is contained in:
parent
d29f6efad8
commit
01a126b384
1 changed files with 8 additions and 1 deletions
|
@ -307,8 +307,15 @@ class Magic {
|
|||
const entropyTests = OperationConfig[op.op].entropyTests;
|
||||
let outputEntropy = 0;
|
||||
if (entropyTests) {
|
||||
let score = 0;
|
||||
outputEntropy = this.calcEntropy(new Uint8Array(output));
|
||||
if (inputEntropy < outputEntropy)
|
||||
if (inputEntropy > outputEntropy)
|
||||
score += 1;
|
||||
if (inputEntropy > entropyTests.input[0] && inputEntropy < entropyTests.input[1])
|
||||
score += 1;
|
||||
if (outputEntropy > entropyTests.output[0] && outputEntropy < entropyTests.output[1])
|
||||
score += 1;
|
||||
if (!score)
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue