crc

Calulate crc of an ethernet frames

 ̄綄美尐妖づ 提交于 2019-12-11 20:18:07
问题 I want to caculate in a tcl script the CRC for this frame : 00000A00080000000A00090000004500002E0000000040117AC00000000000000000003F003F001AB6EB000102030405060708090A0B0C0D0E0F1011 The expected CRC is 0x1652255A. I tried the following (found here): % set string \x00\x00\x0A\x00\x08\x00\x00\x00\x0A\x00\x09\x00\x00\x00\x45\x00\x00\x2E\x00\x00\x00\x00\x40\x11\x7A\xC0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3F\x00\x3F\x00\x1A\xB6\xEB\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\ x0D\x0E\x0F

crc16 algorithm from C++ to bash

大憨熊 提交于 2019-12-11 18:29:06
问题 I am trying to implement a CRC16 checksum in bash. I'm porting from an existing piece of C++ code. I'm almost there, but I am getting different answers. I don't quite see why the checksums between the C++ code and the bash script are different. Another set of eyes would be a big help. Here is the C++ code: uint16_t Encoder::checksum(std::string thestring) { uint8_t d, e, f; uint16_t c, r, crccalc; c = 0xffff; for (unsigned int i = 0; i < thestring.length(); i++) { d = thestring[i]; e = c ^ d;

Converting crc code from C to Java yields unexpected results

大憨熊 提交于 2019-12-11 18:14:12
问题 I am trying to convert CRC C code to Java but I am not getting expected results. Here is what I have so far... C Code #include <stdio.h> #include <stdint.h> #include <string.h> //Partial code to unit test function /// zlib's CRC32 polynomial const uint32_t CrcPolynomial = 0xEDB88320; /// compute CRC32 (bitwise algorithm) uint32_t Crc32Bitwise(const void* data, size_t length, uint32_t previousCrc32) { uint32_t crc = ~previousCrc32; // same as previousCrc32 ^ 0xFFFFFFFF const uint8_t* current =

Find the Algorithm that generates the checksum

蓝咒 提交于 2019-12-11 13:52:56
问题 I have a sensing device that transmits a 6-byte message along with an 1-byte counter and supposedly a checksum. The data looks something like this: ------DATA----------- -Counter- --Checksum?-- 55 FF 00 00 EC FF ---- 60---------- 1F The last four bits in the counter are always set 0, i.e those bits are probably not used. The last byte is assumed to be the checksum since it has a quite peculiar nature. It tends to randomly change as data changes. Now what I need is to find the algorithm to

CRC16-ITU proof

孤街浪徒 提交于 2019-12-11 10:40:07
问题 guys. I am using CRC16-ITU check in order to compare some data, but it is not match when I compared CRC16-ITU and packet data with CRC16 from device. Here is CRC16-ITU table. u16 crctab16[256] = { 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726,

Java code for CRC calculation

百般思念 提交于 2019-12-11 08:33:26
问题 I already have working examples that calculate CRC-8, CRC-16, CRC-32 in Java but they are different implementations and I am a bit confused. I tried to read the math tech docs, but it seems a bit too much for my math level. Also, converting code from C/C++ is not as straight forward since Java does not do well with unsigned primitives... I need a complete example to understand and be able to verify my checksums since there are a lot of different polynomials out there! See Best CRC Polynomials

How to determine checksum from decoded IR remotes

十年热恋 提交于 2019-12-11 06:32:40
问题 I have a small 3.5ch USeries helicopter controlled by an IR remote control, using an Arduino I have decoded its 32 bit protocol. Except for last 3 bits which appear to be some form of checksum. As I have successfully decoding the channels from the remote, in that they track their corresponding controls, I can see that slight changes in the controls yield specific changes in the 3 bits, that are very reproducible and deterministic. Whereas I have not yet found a common theme or formal to

Which datatype is better in calculation of CRC16 for any type of file

夙愿已清 提交于 2019-12-11 05:08:13
问题 Here i am using two different functions for calculating CRC16 for any type of file (.txt,.tar,.tar.gz,.bin,.scr,.sh etc) and different size also varies from 1 KB to 5 GB . I want to achieve this `cross platform less time consuming Have to work proper for any type of file and any size` i got same value of CRC in both functions. but any one can tell me which one is more better to calculate CRC16 for any type of file with any size on different different platform. Here we have to consider 0 to

Why is the Frame Check Sequence at the end of an Ethernet frame and not somewhere else

吃可爱长大的小学妹 提交于 2019-12-11 04:30:58
问题 An Ethernet Frame Check Sequence is always appended to the end of a frame in the Data Link Layer. Why is it appended to the end of the frame and not somewhere else? I thought about it and think it might have something to do with how e.g. CRC-checksums are calculated and that it's easier performed by hardware if the structure of a frame is header+payload+crc rather than header+crc+payload. CRC performs an XOR division of the form (data+padding)/divisor, and for the final frame the padding is

Delphi 5 to 2010

半腔热情 提交于 2019-12-11 01:22:48
问题 I used same function ( OneWayEncrypt(edit1.Text) ) in Delphi 5 and 2010. Why the results are different? (Or how can I give the same results from Delphi 2010?) uses Sysutils, Windows, Dialogs, classes; function OneWayEncrypt(AStr: string): string; PROCEDURE CalcCRC32 (p: pointer; ByteCount: DWORD; VAR CRCvalue: DWORD); implementation const table: ARRAY[0..255] OF DWORD = ( //table consts are here ); PROCEDURE CalcCRC32(p: pointer; ByteCount: DWORD; VAR CRCvalue: DWORD); VAR i: DWORD; q: ^Byte;