Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 231051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:54:03+00:00 2026-05-11T19:54:03+00:00

The Adler-32 checksum algorithm does sums modulo 65521. I know that 65521 is the

  • 0

The Adler-32 checksum algorithm does sums modulo 65521. I know that 65521 is the largest prime number that fits in 16 bits, but why is it important to use a prime number in this algorithm?

(I’m sure the answer will seem obvious once someone tells me, but the number-theory parts of my brain just aren’t working. Even without expertise in checksum algorithms, a smart person who reads http://en.wikipedia.org/wiki/Fletcher%27s_checksum can probably explain it to me.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:54:03+00:00Added an answer on May 11, 2026 at 7:54 pm

    Why was mod prime used for Adler32?

    From Adler’s own website http://zlib.net/zlib_tech.html

    However, Adler-32
    has been constructed to minimize the
    ways to make small changes in the data
    that result in the same check value,
    through the use of sums significantly
    larger than the bytes and by using a
    prime (65521) for the modulus. It is
    in this area that some analysis is
    deserved, but it has not yet been
    done.

    The main reason for Adler-32 is, of
    course, speed in software
    implementations.

    An alternative to Adler-32 is Fletcher-32, which replaces the modulo of 65521 with 65535. This paper shows that Fletcher-32 is superior for channels with low-rate random bit errors.

    It was used because primes tend to have better mixing properties. Exactly how good it is remains to be discussed.

    Other Explanations

    Someone else in this thread makes a somewhat convincing argument that modulus a prime is better for detecting bit-swapping. However, this is most likely not the case because bit-swapping is extremely rare. The two most prevalent errors are:

    1. Random bit-flips (1 <-> 0) common anywhere.
    2. Bit shifting (1 2 3 4 5 -> 2 3 4 5 or 1 1 2 3 4 5) common in networking

    Most of the bit-swapping out there is caused by random bit-flips that happened to look like a bit swap.

    Error correction codes are in fact, designed to withstand n-bits of deviation. From Adler’s website:

    A properly constructed CRC-n has the
    nice property that less than n bits in
    error is always detectable. This is
    not always true for Adler-32–it can
    detect all one- or two-byte errors but
    can miss some three-byte errors.

    Effectiveness of using a prime modulus

    I did a long writeup on essentially the same question. Why modulo a prime number?

    http://www.codexon.com/posts/hash-functions-the-modulo-prime-myth

    The short answer

    We know much less about prime numbers than composite ones. Therefore people like Knuth started using them.

    While it might be true that primes have less relationship to much of the data we hash, increasing the table/modulo size also decreases the probability of a collision (sometimes more than any benefit gained from rounding down to the nearest prime).

    Here is a graph of collisions per bucket with 10 million cryptographically random integers comparing mod 65521 vs 65535.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 215k
  • Answers 215k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer About return: Prelude> :t return return :: (Monad m) =>… May 12, 2026 at 11:01 pm
  • Editorial Team
    Editorial Team added an answer You could also try EXISTS: SELECT EXISTS(SELECT * FROM table1… May 12, 2026 at 11:01 pm
  • Editorial Team
    Editorial Team added an answer Lex is typically just used for tokenizing, not full parsing.… May 12, 2026 at 11:01 pm

Related Questions

I find myself needing to generate a checksum for a string of data, for
I've read before here on SO ( EDIT: Incremental Checksums ) that there are
I'm using a combination of Paul Duncans php ZipStream ( http://pablotron.org/software/zipstream-php/ ) on the
I've been extremely unsuccessful in compiling Botan as a static library in Visual C++.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.