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 4267386
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:53:32+00:00 2026-05-21T06:53:32+00:00

I need to Hash a NSString using murmurhash i am forced to do that

  • 0

I need to Hash a NSString using murmurhash i am forced to do that because the other team is doing so, I need to use the 64-bit key length on x86 platform, have anyone implemented or used murmurhash in objective-C?

Murmurhash 64 is a .cpp file and i can’t get it compiled in iOS SDK 4.3, also tried to rename it to .mm but the result still the same.

Any help or Guide would be greatly appreciated.

I will post the Compilation Error Messages if someone is interested.

  • 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-21T06:53:33+00:00Added an answer on May 21, 2026 at 6:53 am

    For all those who will come to look for the correct answer, here is the deal:

    MurmurHash64.h class
    careful I have changed the typedef

    // MurmurHash, by Austin Appleby
    
    typedef unsigned long long uint64_t;
    
    uint64_t MurmurHash64B ( const void * key, int len, unsigned int seed );
    

    MurmurHash64.m class

    #include "MurmurHash64.h"
    // 64-bit hash for 32-bit platforms
    
    uint64_t MurmurHash64B ( const void * key, int len, unsigned int seed )
    {
        const unsigned int m = 0x5bd1e995;
        const int r = 24;
    
        unsigned int h1 = seed ^ len;
        unsigned int h2 = 0;
    
        const unsigned int * data = (const unsigned int *)key;
    
        while(len >= 8)
        {
           unsigned int k1 = *data++;
           k1 *= m; k1 ^= k1 >> r; k1 *= m;
           h1 *= m; h1 ^= k1;
           len -= 4;
    
           unsigned int k2 = *data++;
           k2 *= m; k2 ^= k2 >> r; k2 *= m;
           h2 *= m; h2 ^= k2;
           len -= 4;
        }
    
        if(len >= 4)
        {
           unsigned int k1 = *data++;
           k1 *= m; k1 ^= k1 >> r; k1 *= m;
           h1 *= m; h1 ^= k1;
           len -= 4;
        }
    
        switch(len)
        {
            case 3: h2 ^= ((unsigned char*)data)[2] << 16;
            case 2: h2 ^= ((unsigned char*)data)[1] << 8;
            case 1: h2 ^= ((unsigned char*)data)[0];
            h2 *= m;
        };
    
        h1 ^= h2 >> 18; h1 *= m;
        h2 ^= h1 >> 22; h2 *= m;
        h1 ^= h2 >> 17; h1 *= m;
        h2 ^= h1 >> 19; h2 *= m;
    
        uint64_t h = h1;
    
        h = (h << 32) | h2;
    
        return h;
    }   
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a project where I need to use some hash function to
I can't use boost:hash because I have to stick with C and can't use
I need an hash algorithm that outputs an alphanumeric string that is max 20
I have file that I need to hash, this file can be too large
In Objective C I've been using the following code to hash a string: -(NSString
I need a hash that can be represented in less than 26 chars Md5
I need to generate a hash using HMAC SHA256. I am using the following
Possible Duplicate: MD5 algorithm in Objective C I need to hash a string using
In my code, I need to hash files using a variety of algorithms, including
I need to hash (MD5) all the password in our Sql Server 2000 database.

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.