crc

Algorithm CRC-12

*爱你&永不变心* 提交于 2019-12-10 19:34:39
问题 I am trying to do crc_table for 12-bit CRC and the algorithm, but always I got wrong results. Can you help me? To create crc table I try: void crcInit(void) { unsigned short remainder; int dividend; unsigned char bit; for (dividend = 0; dividend < 256; ++dividend) { remainder = dividend << 4; for (bit = 8; bit > 0; --bit) { if (remainder & 0x800) { remainder = (remainder << 1) ^ 0x180D; //Polynomio of CRC-12 } else { remainder = (remainder << 1); } } crcTable[dividend] = remainder; } } I

How to detect a changed webpage?

烂漫一生 提交于 2019-12-10 19:20:01
问题 In my application, I fetch webpages periodically using LWP. Is there anyway to check whether between two consecutive fetches the webpage has got changed in some respect (other than explicitly doing a comparison) ? Is there any signature(say CRC) that is being generated at lower protocol layers which can be extracted and compared against older signatures to see possible changes ? 回答1: There are two possible approaches. One is to use a digest of the page, e.g. use strict; use warnings; use

How to calculate CRC of a WinRAR file?

只愿长相守 提交于 2019-12-10 17:25:56
问题 I know CRC calculation algorithm from Wikipedia. About structure of RAR file I read here. For example, there was written: The file has the magic number of: 0x 52 61 72 21 1A 07 00 Which is a break down of the following to describe an Archive Header: 0x6152 - HEAD_CRC 0x72 - HEAD_TYPE 0x1A21 - HEAD_FLAGS 0x0007 - HEAD_SIZE If I understand correctly, the HEAD_CRC (0x6152) is CRC value of Marker Block (MARK_HEAD). Somewhere I read, that CRC of a WinRAR file is calculated with standard polynomial

ruby: `read': Invalid argument -(Errno::EINVAL) at File.read

冷暖自知 提交于 2019-12-10 10:02:22
问题 I'm doing a simple script to check crc of all files... require "zlib" exit if Object.const_defined?(:Ocra) files = Dir.glob("*") File.open('dir.txt', 'a+') do |file| file.puts files end File.read('dir.txt').each_line { |line| file = File.read(line) ; nil file_crc = Zlib.crc32(file,0).to_s(16) puts line, file_crc } The problem is at the line File.read('dir.txt').each_line { |line| I get this error: test.rb:13:in `read': Invalid argument - 1.exe (Errno::EINVAL) from C:/Users/Administrador

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

扶醉桌前 提交于 2019-12-09 15:25:31
问题 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

Android CRC-CCITT

假装没事ソ 提交于 2019-12-09 07:20:18
问题 I need a CRC check for an application Im writing, but cant figure out for the online code and calculators what im doing wrong. I may just not understand it correctly. This is what I need : It uses CRC-CCITT with a starting value of 0xFFFF with reverse input bit order. For example, the Get Device Type message is: 0x01, 0x06, 0x01, 0x00, 0x0B, 0xD9. The CRC is 0xD90B. And this is the code Im using : public static int CRC16CCITT(byte[] bytes) { int crc = 0xFFFF; // initial value int polynomial =

How to calculate CRC-16 from HEX values?

人走茶凉 提交于 2019-12-09 06:54:41
问题 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: //

Calculate CRC8-Maxim checksum in Java

风流意气都作罢 提交于 2019-12-08 13:33:15
问题 I'm trying to code a CRC8-Maxim calculator in java but I'm stuck. I've tried many API's such as Jacksum, but nothing worked like it should. The only thing I found is this website: http://www.sunshine2k.de/coding/javascript/crc/crc_js.html If I choose the CRC8-Maxim setting, the result is exactly what I need it to be. (example: The checksum of VR1,?, should be D7) Do you have any idea, how I could code that in java? I need it for my final school project and there's not much time left. Thanks

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