Questions tagged [checksum]

A checksum or hash sum is a fixed-size datum computed from an arbitrary block of digital data for the purpose of detecting accidental errors that may have been introduced during its transmission or storage. The integrity of the data can be checked at any later time by recomputing the checksum and comparing it with the stored one.

A checksum or hash sum is a fixed-size datum computed from an arbitrary block of digital data for the purpose of detecting accidental errors that may have been introduced during its transmission or storage.

The integrity of the data can be checked at any later time by recomputing the checksum and comparing it with the stored one. This process doesn't guarentee the data hasn't been corrupted, but is a good indication.

1882 questions
0
votes
2 answers

Python: Get string hex XOR two digit checksum

Newbie here. I'm trying to get a hex XOR checksum of a string; and I have the following Python 2.7 code: def getCheckSum(sentence): calc_cksum = 0 for s in sentence: calc_cksum ^= ord(s) return…
bipster
  • 404
  • 1
  • 8
  • 20
0
votes
1 answer

How do I implement a CRC16 with a custom polynomial in Javascript?

Background I need to implement a CRC16 with a custom polynomial in Javascript. Research After searching several NPM modules and this SO question ( as well as all the links the comments suggest ): Javascript CRC16 sample code or…
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
0
votes
1 answer

Bad Checksum when Calculating UDP Checksum

I spent some time trying to calculate the UDP checksum, but every time I observe the packets in Wireshark, it says that the checksum is incorrect. Here's the code: uint16_t compute_udp_checksum(IP *ip, UDP *u, void *data, int…
user9583381
0
votes
1 answer

How to Calculate Xor for data

I'm trying to implement checksum for some commands to communicate with internal ROM using uart. eg: commad code 0x02 + 0xFD will give id of the device. How 0xFD is calculated? From the data sheet: All communications from the programming tool (PC) to…
SamForiYana
  • 53
  • 1
  • 2
  • 11
0
votes
1 answer

Calculate a checksum for a file

I have a csv file and I am trying to calculate a checksum for it. The documentation says that I need to convert char values to decimals using this table: The formula is ASCII("Character") - 48. So, 'D' would be 20. Because in ASCII 'D' is 68 and if…
Jahongir Rahmonov
  • 13,083
  • 10
  • 47
  • 91
0
votes
0 answers

Trying to calc Modbus RTU CRC . What is Wrong?

I'm trying to calculate a crc modbus in an application for PIC, but the crc returned is always incorrect compared to simulators online .. follow the code void CRC (unsigned char * msg, unsigned char * out) {     // char CRC16 [2] = {0xFF,…
0
votes
1 answer

Mssql binary_checksum in LUA

I'd like to translate mssql binary_checksum from c# to Lua, but i'm a newbie in Lua... private static int SQLBinaryChecksum(string text) { long sum = 0; byte overflow; for (int i = 0; i < text.Length; i++) { sum = (long)((16…
Reminus
  • 1
  • 1
0
votes
1 answer

Error with fread() in c, not having expected outut

I'm making a checksum algorithm for one of my classes, I want to read two binary files and run them through a checksum algorithm. The checksum algorithm works (I've tried inputting what I want into the terminal and it works) but I can't get my…
0
votes
1 answer

Can we calculate the difference between two hash checksums?

More exactly, let's say we have two images and we do the MD5 or SHA-256 of each. Is there an algorithm to calculate the percentage difference/similarity between the two checksums? To say image_1 is 26% similar to image_2 ? I don't necessarily want…
Pobosa A
  • 41
  • 7
0
votes
1 answer

1's complement checksum even bit errors

I am trying to wrap my head around 1's complement checksum error detection as is used in UDP. My understanding with simplified example for an UDP-like 1's complement checksum error checking algorithm operating on 8 bit words (I know UDP uses 16 bit…
TTT
  • 1,952
  • 18
  • 33
0
votes
1 answer

How to add cksum in find command

$ cksum sample.txt 2763733609 1659 sample.txt $ find /usr/local/sqoop -printf '%i,%b,%M,%n,%u,%g,%s,%Tc,%h/%f'$'\n' 19404466,8,-rwxr-xr-x,1,hduser,hduser,1345,Monday 27 April 2015 12:12:36 PM IST,/usr/local/sqoop/conf/sqoop-env-template.sh After…
Fazil
  • 51
  • 2
  • 4
0
votes
1 answer

libnet that properly calculates checksum on IPV6

I have recently started playing around with libnet and using it to generate IPV6 packets. I am very new at programming, however, I am quite happy with the library. I have one problem with it though. It seems that libnet currently does not have…
VeaEm
0
votes
1 answer

Checksum option in MYSQL to assign to each field

I've seen examples using crc, but the examples I've got my head round work with generating a checksum for entire table data (for use with replication and data validation). For example: SELECT crc FROM ( SELECT @r := MD5(CONCAT(property_id,…
Ade
  • 3
  • 2
0
votes
2 answers

How to Calculate Checksum and Verify Against Register with Batch File?

How can I calculate checksum and verify against a register with a batch file? I'm trying to use a redirect/pipe inspired by https://stackoverflow.com/a/42706309/4539999 (best called from a batch file) and looking for something simpler than…
flywire
  • 1,155
  • 1
  • 14
  • 38
0
votes
1 answer

TCP checksum for two structures

I am trying to make a function that generates checksums for TCP, but I work with two structures of TCP, because the tcphdr structure made for Mac OS X in tcp.h header does not contain everything that I need to make a packet. My packet contains the…
John John
  • 35
  • 6