Questions tagged [checksum]

A checksum is a small chunk of data calculated from another larger piece of data, used to detect any transmission errors in the data. Use this tag for questions related to calculating or verifying checksums. (See also hashing)

Filter by
Sorted by
Tagged with
25 votes
28 answers

Generate Parity bits

Given a binary message, and the number of parity bits, generate the associated parity bits. A parity bit is a simple form of error detection. It's generated by counting the number of ...
  • 5,181
13 votes
7 answers

Encode the systematic binary Varshamov–Tenengolts code

Background Here on CGCC, a commonly seen subgenre is radiation-hardening – writing a program that works even if one character is deleted. A similar problem is studied in the field of coding theory: ...
14 votes
12 answers

Compute the Redwolf Checksum™ of some data

I will preface this by saying that I made this for fun; I have absolutely no formal knowledge on cryptography or error correction. Do not use this algorithm in anything remotely important. I was kind ...
22 votes
19 answers

For what block sizes is this checksum valid?

The input: As an example, take a list containing a number of bits (in this case, 32): 11000010000100111011000011001011 We can calculate a simple checksum of this ...
21 votes
22 answers

Converting ISBN-13 to ISBN-10

Introduction In this challenge your task is to generate the ISBN-10 code for books given its ISBN-13 code, assuming that such a code exists. Such an ISBN-13 code consists of several parts separated ...
  • 16.5k
36 votes
59 answers

Is my barcode valid?

An EAN-8 barcode includes 7 digits of information and an 8th checksum digit. The checksum is calculated by multiplying the digits by 3 and 1 alternately, adding the results, and subtracting from the ...
  • 14k
32 votes
38 answers

Compute the Adler-32 checksum

Background Adler-32 is a 32-bit checksum invented by Mark Adler in 1995 which is part of the widely used zlib library (also developed by Adler). Adler-32 is not as reliable as a 32-bit cyclic ...
  • 207k
20 votes
23 answers

Generate a parity bit

A parity bit, is one of the simplest forms of a checksum. First, you have to pick the parity, even or odd. Let's say we pick even. Now, we need a message to transmit. Let's say our message is "...
  • 57.4k
30 votes
49 answers

Calculate ISBN-13 check digit

Write a function which, given the first 12 digits of an ISBN-13 code, will calculate the entire ISBN via calculating and appending an appropriate check digit. Your function's input is a string ...
57 votes
57 answers

The Luhn algorithm for verifying credit card numbers, etc

Challenge Write the shortest program or function to calculate the Luhn Algorithm for verifying (credit card) numbers. Luhn algorithm explained From RosettaCode, this algorithm for the purposes of ...