• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 529
  • Last Modified:

Simple cryptographic hash function

I am aware of the theory and purpose of cryptographic hashes like MD5, SHA, etc.
I also am interested in using a simple crypto hash in a small project I am currently dreaming up.  I say simple because i want the code for this project to be *extremely* small.  Under 1k would be good, under 512 bytes is my true goal.

I need to take in 10-50 bytes of a seed and create a 4-10 byte hash that can, of course, be guaranteed the same each time with the same input, and maximizing unique outputs for unique inputs.

I realize that this is a difficult, if not impossible, task.  What I am looking for is resources describing some lower theory of crypto hashes, like how to program them from scratch, and possibly some examples of existing simple crypto hash algorithms.
0
arantius
Asked:
arantius
1 Solution
 
LRHGuyCommented:
You might consider looking here:

http://sourceforge.net/projects/tplockbox/

TurboPower's lockbox is free, with source (Delphi) ... but more than that, it has multiple methods, and the documentation is excellent...you'll find lots of info about MD5, etc...in the documentation, even if you don't use delphi.
0
 
ozoCommented:
What cryptographic propertys do you require of your hash function?
A 4 byte hash would be extremely weak against attack, and collisions could easily be found by exhaustive search.
http://en.wikipedia.org/wiki/Cryptographic_hash_function
0
 
arantiusAuthor Commented:
In short, I'm trying to write my own version of this password bookmarklet, there's a few changes I'd like to incorporate: http://www.angel.net/~nic/passwdlet.html

That one uses full MD5 (AFAIK) but I don't think it's necessary for this particular project.  The hash does not have to be so cryptographically strong, though I'm quite leaning towards the 8+ byte end of the size.  I just want to make sure that whatever I choose it won't be too big and break a website.  It will also, though, likely be encoded into hex so the 4 bytes would become 8 wasted bytes in the end.  Haven't decided which characters exactly I'd include.
The point of the project is minimization of risk should the password you use for a website be found/leaked.  Collisions are no problem.  There is not, necessarily, even the knowledge that you used this generator should the password become public.

With the further looking I've done since my first post, I am probably going to end up largely giving up on trying to keep it small enough to fit into IE's 508 byte limit.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

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