Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sn99 committed Jan 25, 2023
1 parent a5261b3 commit 67d2d21
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions minifilter/snFilter/ShanonEntropy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ _Kernel_float_used_ DOUBLE shannonEntropy(PUCHAR buffer, size_t size) {
}

__try {
if (NT_SUCCESS(Status)) {
for (ULONG i = 0; i < MAX_BYTE_SIZE; i++) {
if (bucketByteVals[i] != 0) {
DOUBLE
val = (DOUBLE)bucketByteVals[i] / (DOUBLE)size;
entropy += (-1) * val * log(val) * M_LOG2E;
}
for (ULONG i = 0; i < MAX_BYTE_SIZE; i++) {
if (bucketByteVals[i] != 0) {
DOUBLE
val = (DOUBLE)bucketByteVals[i] / (DOUBLE)size;
entropy += (-1) * val * log(val) * M_LOG2E;
}
}
} __finally {}
} __finally {
}

return entropy;
}

0 comments on commit 67d2d21

Please sign in to comment.