Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 220
  • Last Modified:

hash function wanted

In order to index an adress book, i am looking for a simple hash function.
Say take a 48 byte names and make 4 bytes digest.
0
toTo
Asked:
toTo
1 Solution
 
3rsrichardCommented:
char input[48];
char output[4];
int i;

for (i=0; i<48; i+=4){
output[0] ^= input[i];
output[1]^=input[i+1];
output[2]^=input[i+2];
output[3]"=input[i+3];
};

or did you want something fancier??
0
 
AxterCommented:
Is this homework?
0
 
graham_kCommented:
http://burtleburtle.net/bob/hash/doobs.html
http://www.cs.technion.ac.il/~biham/Reports/Tiger/

etc, etc, as long as it isn't homwwork. If it is, forget that you read that.

















Actually, if it is homework, best not use these, as your prof will see immediately that the code is far too advanced for you to have written. Of course, if it isn't, just plug the code in & use it.
0
 
toToAuthor Commented:
Thank you to provides those URLs
I could not find them on search engins.
Thanks to 3rsrichard, too bad it is not homework, his answer would have been a good start.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now