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

  • SEARCH
  • Home
  • 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 7579389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:40:01+00:00 2026-05-30T17:40:01+00:00

The fletcher16 source code is given like this on wikipedia . uint16_t Fletcher16( uint8_t*

  • 0

The fletcher16 source code is given like this on wikipedia.

uint16_t Fletcher16( uint8_t* data, int count )
{
   uint16_t sum1 = 0;
   uint16_t sum2 = 0;
   int index;

   for( index = 0; index < count; ++index )
   {
      sum1 = (sum1 + data[index]) % 255;
      sum2 = (sum2 + sum1) % 255;
   }

   return (sum2 << 8) | sum1;
}

From that example, I implemented the 64 bit version as follows.

unsigned long Fletcher64( unsigned int* data, int count )
{
   unsigned long sum1 = 0;
   unsigned long sum2 = 0;
   int index;

   for( index = 0; index < count; ++index )
   {
      sum1 = (sum1 + data[index]) % UINT_MAX; // UINT_MAX = 2^32
      sum2 = (sum2 + sum1) % UINT_MAX;
   }

   return (sum2 << 32) | sum1;
}

Is my approach correct, or am I doing something wrong?

  • 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-30T17:40:03+00:00Added an answer on May 30, 2026 at 5:40 pm

    Most hash algorithms take parameters of a block of memory and the number of bytes (or sometimes bits) to hash. You have changed a byte count to a word count—a rather significant change.

    Also, since you have changed the calculation size, the way sum2 is computed has changed. This is fine as long as you are not trying to replicate the original algorithm value-per-value, but if this is meant as a compatible optimization, then this is probably wrong.

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

Sidebar

Related Questions

Is this conversion right from the original? uint8_t fletcher8( uint8_t *data, uint8_t len )
NSString *list = @Norman, Stanley, Fletcher; NSMutableArray *a2 = [[NSMutableArray alloc] init]; //a2= [list
I'm building my first WiX installer after becoming sick of the sight of Wise
Using Enrollment.xml and Person.xml documents, I'm trying to list the names of students who
I need to send the value and the text of a select box input
The Adler-32 checksum algorithm does sums modulo 65521. I know that 65521 is the
I've read before here on SO ( EDIT: Incremental Checksums ) that there are
I am creating a lite version of my app, and used Chris Fletcher's blog
ALTER PROCEDURE [dbo].[GetValues] @FieldName NVARCHAR(50), @FormName NVARCHAR(50), @PoolName NVARCHAR(50) AS SELECT FieldValue FROM [dbo].[Values]

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.