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

C implementation doesn't work with larger messages. #29

Closed
doino-gretchenliev opened this issue Nov 29, 2020 · 3 comments
Closed

C implementation doesn't work with larger messages. #29

doino-gretchenliev opened this issue Nov 29, 2020 · 3 comments

Comments

@doino-gretchenliev
Copy link

I'm using the following code:

import creedsolo as rs
prim = rs.find_prime_polys(c_exp=12, fast_primes=False, single=True)
rs.init_tables(prim=prim, c_exp=12)

The error thrown is:

    c_gf_log, c_gf_exp, c_field_charac = rs.init_tables(prim=prim, c_exp=12)
  File "creedsolo.pyx", line 203, in creedsolo.init_tables
OverflowError: value too large to convert to unsigned char

I'm trying to encode a file with 4095 sized chunks without using the additional 255 internal splittings. I've precalculated the polynomial numbers. So far I was able to encode, but not to decode the message:

import creedsolo as rs
rs.init_tables()

mesecc = rs.rs_encode_msg(data, nsym, gen=gen[nsym]) # nsym = 123, len(data) = 3972
rmes, rmesecc, errata_pos = rs.rs_correct_msg(mesecc, nsym)

The error thrown is:

    rmes, rmesecc, errata_pos = rs.rs_correct_msg(mesecc, nsym)
  File "creedsolo.pyx", line 694, in creedsolo.rs_correct_msg
ValueError: Message is too long (4095 when max is 255)

Is there a way to encode 4095 chunks without hidden splitting?

@lrq3000
Copy link
Collaborator

lrq3000 commented Dec 8, 2022

Maybe related to #44

@lrq3000
Copy link
Collaborator

lrq3000 commented Dec 8, 2022

Ok so this is an inherent limitation because the C implementation only works with bytearrays, and bytearrays only support characters up to 255 IIRC. If you want to use higher galois fields, you need to use the pure python version, or rewrite the C implementation to use lists instead of bytearrays (which will be MUCH slower so this defeats the purpose and you are better off simply using the pure python version under PyPy).

About the lack of chunking, this is an issue also reported in #44, I will maybe merge the fix offered there.

@lrq3000
Copy link
Collaborator

lrq3000 commented Dec 8, 2022

Ah no there is no chunking anyway when you directly call the functions without the RSCodec object, it's only RSCodec that can do automatic chunking, not the functions.

lrq3000 added a commit that referenced this issue Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants