Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting maximum data length #30

Open
spequer opened this issue Mar 31, 2023 · 0 comments
Open

Getting maximum data length #30

spequer opened this issue Mar 31, 2023 · 0 comments
Labels

Comments

@spequer
Copy link

spequer commented Mar 31, 2023

I'm using following code to get maximum possible data length with bch setting:

  • bch.c
        /* sanity check: make sure data length can be handled */
        if (8*len > (bch->n-bch->ecc_bits)) {
                printf("Error: Invalid length: %d %d (%d)\n", len, (bch->n-bch->ecc_bits) / 8, bch->n-bch->ecc_bits);
                return -EINVAL;
        }

Using following code to extract the result:

    data = bytearray(data[:1000])
    ic(len(data), bch.ecc_bytes , bch.ecc_bits, bch.m, bch.n, bch.t )
    ecc = bch.encode(data)

The value 919 (polynominal 8219, bits 64) is not shown in read-only settings:
ic| len(data): 1000
bch.ecc_bytes: 104
bch.ecc_bits: 832
bch.m: 13
bch.n: 8191
bch.t: 64
ic| len(data): 1000, len(ecc): 104
Error: Invalid length: 1000 919 (7359)

It seems it is the value (8191-832) / 8 = 919..

@jkent jkent added the question label Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants