usnistgov / SP800-90B_EntropyAssessment

The SP800-90B_EntropyAssessment C++package implements the min-entropy assessment methods included in Special Publication 800-90B.
202 stars 87 forks source link

The test for a valid compression test is dropped #177

Closed joshuaehill closed 2 years ago

joshuaehill commented 2 years ago

This test was merged out of existance, and it is important. Please replicate the testing that occurs in the binary compression testing just above.

https://github.com/usnistgov/SP800-90B_EntropyAssessment/blob/88107c861e8951d499c69d8c9de68836c18190b7/cpp/non_iid_main.cpp#L296

celic commented 2 years ago

You are saying the correct set of lines should be this?

    // Section 6.3.4 - Estimate entropy with Compression Test (for bit strings only)
    if (((data.alph_size > 2) || !initial_entropy)) {
        ret_min_entropy = compression_test(data.bsymbols, data.blen, verbose, "Bitstring");
        if (ret_min_entropy >= 0) {
            if (verbose == 1) printf("\tCompression Test Estimate (bit string) = %f / 1 bit(s)\n", ret_min_entropy);
            H_bitstring = min(ret_min_entropy, H_bitstring);
        }
    }

    if (initial_entropy && (data.alph_size == 2)) {
        ret_min_entropy = compression_test(data.symbols, data.len, verbose, "Literal");
        if (ret_min_entropy >= 0) {
            if (verbose == 1) printf("\tCompression Test Estimate = %f / 1 bit(s)\n", ret_min_entropy);
            H_original = min(ret_min_entropy, H_original);    
        }
    }
joshuaehill commented 2 years ago

That looks correct, yes. There were a couple of additional instances of this sort of thing that I pointed out in comments.

celic commented 2 years ago

For some reason I can't see the comments when looking at the commit on GH. So I pushed a new release v1.1.1 that fixes the comments I could see. Could you put the comments elsewhere with the referenced lines so I can fix them?

joshuaehill commented 2 years ago

Will do.

celic commented 2 years ago

Closing current issue as it's been resolved.