crc

Calculating FCS(CRC) for HDLC frame

隐身守侯 提交于 2019-12-04 08:44:57
问题 I have the following frame: 7e 01 00 00 01 00 18 ef 00 00 00 b5 20 c1 05 10 02 71 2e 1a c2 05 10 01 71 00 6e 87 02 00 01 42 71 2e 1a 01 96 27 be 27 54 17 3d b9 93 ac 7e If I understand correctly, then it is this portion of the frame on which the FCS is calculated: 010000010018ef000000b520c1051002712e1ac205100171006e8702000142712e1a019627be2754173db9 I've tried entering this into a number of online calculators but I cant produce 0x93ac from the above data. http://www.lammertbies.nl/comm/info

Is there a checksum algorithm that also supports “subtracting” data from it?

心不动则不痛 提交于 2019-12-04 02:25:28
I have a system with roughly a 100 million documents, and I'd like to keep track of their modifications between mirrors. In order to exchange information about modifications effectively, I want to send information about modified documents by days, not by each separate document. Something like this: [ 2012/03/26, cs26], [ 2012/03/25, cs25], [ 2012/03/24, cs24], ... where each cs is the checksum of timestamps of all documents created on a particular day. Now, the problem I'm running into is that I don't know of an algorithm that could "subtract" data from the checksum when a document is being

tricky crc algorithm

帅比萌擦擦* 提交于 2019-12-03 20:43:00
I am trying to find the crc that works with the following results. The byte string consists of 2 bytes (ie. 0xCE1E) and the crc is an single byte (ie. 0x03) byte crc CE1E 03 CE20 45 CE22 6F 0000 C0 0001 D4 FFFF 95 Can anyone help? First, 4 hex digits aren't 4 bytes. Since all your examples show 4 hex digits -- 2 bytes -- I'll assume you mean 2 bytes. There are only 65,536 distinct hash values, here's what you do. Execute the hash function for all 65,536 values from 0000 to FFFF. Tabulate the results. That table is the function. It maps input value to output value. While lame, it's always

What is the inverse of crc32_combine()'s matrix trick?

青春壹個敷衍的年華 提交于 2019-12-03 16:33:56
zlib's crc32_combine() takes crcA, crcB, and lengthB to calculate crcAB. # returns crcAB crc32_combine(crcA, crcB, lenB) Using concepts from Mark Adler's awesome posts here and here I was able to produce crc32_trim_trailing.pl which takes crcAB, crcB, and lengthB to calculate crcA (I use this to peel off padding of a known length and value). # prints crcA perl crc32_trim_trailing.pl $crcAB $crcB $lenB Unfortunately, this uses the principles of the slow method described, where each null byte must be peeled off one at a time. It's slow, but is a good proof of concept. I've been working to make a

CRC-CCITT 16-bit Python Manual Calculation

若如初见. 提交于 2019-12-03 13:33:58
问题 Problem I am writing code for an embedded device. A lot of solutions out there for CRC-CCITT 16-bit calculations require libraries. Given that using libraries is almost impossible and a drain on its resources, a function is required. Possible Solution The following CRC calculation was found online. However, its implementation is incorrect. http://bytes.com/topic/python/insights/887357-python-check-crc-frame-crc-16-ccitt def checkCRC(message): #CRC-16-CITT poly, the CRC sheme used by ymodem

how to calculate CRC value for a file in C#.net?

允我心安 提交于 2019-12-03 09:00:51
i want to calculate the CRC value for a file using 32-bit algorithm in C#.net.... Algorithm is straightforward (rewritten from c++) class Crc32 { public static uint CountCrc(byte[] pBuf) { // Table of CRC-32's of all single byte values uint[] crctab = new uint[] { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,

How to calculate CRC-16 from HEX values?

风格不统一 提交于 2019-12-03 08:43:01
In my code i need to calculate CRC-16 16 bit values for the HEX values stored as NSdata, below is the code snippet to calculate CRC-16 in c. void UpdateCRC(unsigned short int *CRC, unsigned char x) { // This function uses the initial CRC value passed in the first // argument, then modifies it using the single character passed // as the second argument, according to a CRC-16 polynomial // Arguments: // CRC -- pointer to starting CRC value // x -- new character to be processed // Returns: // The function does not return any values, but updates the variable // pointed to by CRC static int const

How to get CRC64 distributed calculation (use its linearity property)?

馋奶兔 提交于 2019-12-03 07:06:18
问题 I need hash over pretty large files which is stored on distributed FS. I'm able to process parts of file with much more better performance than whole file so I'd like to be able to calculate hash over parts and then sum it. I'm thinking about CRC64 as hashing algorithm but I have no clue how to use its theoretical 'linear function' property so I can sum CRC over parts of file. Any recommendation? Anything I missed here? Additional notes why I'm looking at CRC64 : I can control file blocks but

CRC checks for files

南楼画角 提交于 2019-12-03 06:57:09
I'm working with a small FAT16 filesystem, and I want to generate CRC values for indidual XML files which store configuration information. In case the data changes or is corrupted, I want to be able to check the CRC to determine that the file is still in it's original state. The question is, how do I put the CRC value into the file, without changing the CRC value of the file itself? I can think of a couple solutions, but I think there must be a fairly standard solution for this issue. You could append the CRC value to the end of the file. Then, when computing the CRC value later for checking,

C# CRC implementation

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 05:08:55
问题 I am trying to integrate a Serial-port device into my application, which needs CRC-CCTT validation for the bytes that I send to it. I'm kinda new into managing byte packets, and need help for this. It uses this formula for making the CRC calculus: [CRC-CCITT P(X)= X16 + C12 + C8 + 1] So for example for the packet: 0xFC 0x05 0x11, the CRC is 0x5627. Then I send this packet to the device: 0xFC 0x05 0x11 0x27 0x56 Also, packet lenghts will vary from 5 to 255 (including CRC checks bytes) I don't