Coder Social home page Coder Social logo

Comments (5)

SupraSummus avatar SupraSummus commented on May 17, 2024

problem occurs also in @lrq3000's fork (rev 7583ed)

from reedsolomon.

lrq3000 avatar lrq3000 commented on May 17, 2024

@SupraSummus Thank you for the detailed feedback, yes the codec is optimized for speed so it might not have all the checks to ensure that user's input is correct (actually it is assumed that the user should do the input sanitization). I will see if adding a length check is bothersome for performance or not :-) Or at least add something in the docs about this edge case. Keep in mind that RSCodec.encode() is meant to be used in a loop, so the less input checks we do, the faster it is!

from reedsolomon.

SupraSummus avatar SupraSummus commented on May 17, 2024

I didn't mean proposing to add a parameter sanity check. The arguments I provided seem valid to me - they describe RS codec with single-byte chunk and no error correction symbols. In my comprehension such codec should behave as identity for decoding and encoding operations.

... or I missed domain assertions for RS coding and nsyms=0, nsize=1 is not a valid RS actually.

Thank you for attention.

from reedsolomon.

lrq3000 avatar lrq3000 commented on May 17, 2024

@SupraSummus Thank you very much, I see what you mean. With the latest release, here is what we get now:

>>> c.decode(b'aaa')
(bytearray(b''), bytearray(b'aaa'), bytearray(b''))

Which means that the decoded message, which should just result in identity, is not considered as the message but as ecc symbols. This indeed looks weird, I should check inside the code, but I will probably have to dig back to the maths to understand what's happening here, but it's certainly very counterintuitive.

from reedsolomon.

lrq3000 avatar lrq3000 commented on May 17, 2024

Ok I think I understand what's happening here: if nsym is 0, the algo as implemented here will still try to get at least one ecc symbol, hence the input message is considered as the symbols and the message is considered empty, whereas you would expect the opposite.

I'll see how to best fix this issue, whether in the code or if we put a warning.

(TODO for me: add a unit test for this case)

from reedsolomon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.