crc16

how to calculate ANSI CRC16 polynomial (0x8005) in python3?

跟風遠走 提交于 2019-12-13 16:22:06
问题 I tried to calculate ANSI CRC16 polynomial (0x8005) using this code import crcmod crc16 = crcmod.mkCrcFun(0x8005, 0xffff, True) but I got this error message ValueError: The degree of the polynomial must be 8, 16, 24, 32 or 64 回答1: There is an implied 1 at the beginning of 0x8005 crcmod expects you to provide the 1 explicitly import crcmod crc16 = crcmod.mkCrcFun(0x18005, 0xffff, True) 来源: https://stackoverflow.com/questions/24851027/how-to-calculate-ansi-crc16-polynomial-0x8005-in-python3

Calculating CRC initial value instead of appending the CRC to payload

半城伤御伤魂 提交于 2019-12-12 03:13:56
问题 Most of the CRCs I've implemented were appending the calculated CRC value to the message (payload) and checking for a zero result at the receiver after all bytes incl. CRC value were fed through the CRC register. Obviously this is a quite standard approach. Now I would like to use a different approach: Calculate a value from the payload. Use that value as initial value for the CRC register before the message bytes (payload) are fed through the CRC register such that the result after the last

CRC-16 (IBM) Reverse Lookup in C++

断了今生、忘了曾经 提交于 2019-12-12 02:04:57
问题 I'm having trouble with creating a Maxim CRC-16 Algorithm that would match a specific output. I've listed the resources I've used to help me write the program below: Maxim App Note 27 Sanity-Free CRC-16 Computation Julia CRC Computation (By Andrew Cooke) CRC-16 Lookup Table (in C) Another CRC Lookup Table in C CRC Wiki Page With the above references, I wrote a simple program that would compute the CRC-16 using both a bit by bit approach, and a look-up table approach. The bit-by-bit approach

How to Implement CRC-16-DNP using C#?

亡梦爱人 提交于 2019-12-11 20:38:55
问题 I'm trying to implement a 16-CRC [DNP] using c#, the generator polynomial is given as I found a standard solution for 16-crc : [ Source ] public class Crc16 { const ushort polynomial = 0xA001; ushort[] table = new ushort[256]; public ushort ComputeChecksum ( byte[] bytes ) { ushort crc = 0; for ( int i = 0; i < bytes.Length; ++i ) { byte index = ( byte ) ( crc ^ bytes[i] ); crc = ( ushort ) ( ( crc >> 8 ) ^ table[index] ); } return crc; } public byte[] ComputeChecksumBytes ( byte[] bytes ) {

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;

What the lack of CRC-CCITT (0xFFFF)?

拥有回忆 提交于 2019-12-11 10:52:41
问题 Based Online CRC calculation, when I entered hex string data = 503002080000024400003886030400000000010100 I get result CRC-CCITT (0xFFFF) = 0x354E (Expected Result) . I use the code below, but the results of CalcCRC16() are 0xACEE . What the lack of script below? using System; using System.Windows.Forms; using System.Runtime.Remoting.Metadata.W3cXsd2001; using System.Diagnostics; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); }

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,

CRC 16 -DECT with poly x^16 + x^10 + x^8 + x^7 + x^3 + 1

99封情书 提交于 2019-12-11 02:21:41
问题 believe me I have tried to code this, tried Google, and haven't had any luck. I'm trying to implement a CRC16 using this poly x^16 + x^10 + x^8 + x^7 + x^3 + 1 using the C language. Since I understand PHP better I'm trying to get a function going, but I'm not getting the right answer of 28713. This code is generating a CRC of 32713. function crc16($string,$crc=0) { for ( $x=0; $x<strlen( $string ); $x++ ) { $crc = $crc ^ ord( $string[$x] ); echo $crc.'<br />'; for ($y = 0; $y < 8 ; $y++) { if

CRC 16-CCITT with lookup table

风格不统一 提交于 2019-12-08 11:35:27
问题 So what I know about CRC, and also did a Java implementation is this: Having an initial message as a 16-bit polynomial, for instance 0x0617 65 0000.0110.0001.0111 this one gets another 16 of 0 bits 0000.0110.0001.0111|0000.0000.0000.0000 Then, having the divisor, 0x1021 0001.0000.0010.0001 (0, 5, 12) We allign it at the start of each "1" in our initial message, and do XOR between the bits, until there are no more 1s in the initial message. In total, there will be 6 XORs in our example. The

16bit CRC-ITU calculation for Concox tracker

房东的猫 提交于 2019-12-08 10:37:34
问题 I am creating C# code for a server program that receives data from a Concox TR06 GPS tracker via TCP: http://www.iconcox.com/uploads/soft/140920/1-140920023130.pdf When first starting up, the tracker sends a login message, which needs to be acknowledged before it will send any position data. My first problem is that, according to the documentation, the acknowledge message is 18 bytes long, yet the example they provide is only 10 bytes long: P.s. in the table above, the "bits" column I'm