Comments (4)
Hi @smarek,
generally the CRC output should be configureable on a bit size level. From my point of view at lest the bit sizes
[8, 64] should work fine as output widths.
Regarding the input data, I see a single byte as the smallest unit which is expected to be feed into the CRC calculation
(from the client code).
I personally don't plan to add support for feeding single bits into the CRC calculation from the client code.
If you have an idea (concept) or PR for this feature, I am open to discuss if and how we could add it.
best
Nico
P.S. happy holidays
from crc.
Hi @Nicoretti
thank you for reaction, but I think you've missed my point, the CRC-9 is not 9-bit sized just when producing final output, but the input is also not byte sized (135 bits) and i've seen in your code, you assume that the number of operations is // 8
meaning you'll miss few bits, and I'm afraid there are more similar assumptions in your code.
Or should I understand it so that if I pad the input with zeroes it should not change the calculation output?
Anyway you're not supposed to change anything, I just wanted to get clarification, on whether you think your code should be able to handle odd sized payloads and produce odd sized crc result, or not.
Similar project, where eg. CRC-3/CRC-4/CRC-5 and other odd sized calculations are supported by default, is https://sourceforge.net/projects/crccheck/files/
But I don't think you should change anything, unless you want to support similar algorithms as well.
And if you'd want to, there is self-test (see configuration of properties _check_data
and _check_output
) in there, so it should be really easy to unit-test and gradually add support for some of the algorithms, https://sourceforge.net/p/crccheck/code/ci/default/tree/crccheck/crc.py#l280
Also wish you nice and pleasant holidays, cheers!
from crc.
Or should I understand it so that if I pad the input with zeroes it should not change the calculation output?
No wasn't meant that way. I wrote the crc processing/calculation code quite a long time ago.
I need to read up on it again, but you are definitely right about that only chunks of 8 bits (1 byte) are supported as input.
So this must hold true for the input: amount_of_bits(input) % 8 == 0
I thought though the supported output size should be "arbitrary", but not 100% sure without checking in detail.
In any case, I have created #26 to track the "arbitrary" bit width issue you pointed out. I must say though, that
I'm currently focusing on other things. So I don't think I will be able to address this issue any time soon.
best
Nico
from crc.
Status quo should hopefully got clarified in the discussion above, the missing support for all crc widths is tracked in #26
from crc.
Related Issues (20)
- mypy error: Skipping analyzing "crc": [...] missing library stubs or py.typed marker HOT 8
- Invalid checksum for HDLC Frame HOT 2
- π Invalid checksum is calculated when using `Calculator` instead of `Register` classes HOT 10
- Crc8.SAEJ1850 has wrong `init_value` and `final_xor_value` HOT 2
- π Readme update HOT 2
- πPredefined `Crc16.CCITT` is confusing HOT 4
- π§ Refactor CRC-16 Configuration Naming and Expand Variants HOT 4
- π Return of digest() is not stable HOT 2
- π My project on github uses crc. When I ran my tests I got an error relating to CCITT HOT 1
- Inconsistent CRC result for different input type HOT 9
- Add support for arbitrary input and output bit widths HOT 7
- Automate pypi deployment with GitHub action(s) HOT 1
- Automate code coverage reporting with GitHub Actions
- lookup table generation output is wrong HOT 1
- file input handling could be better HOT 1
- Create a pypi release containing the latest changes HOT 1
- Implement Reverse Input/Output Lookup Table when running table_based HOT 7
- Add missing __version__ attribute HOT 2
- "poly" should be "polynomial" in example HOT 1
- Add 16bit MODBUS config HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crc.