Everything2
Near Matches
Ignore Exact
Full Text
Everything2

hash function

created by EE

(idea) by EE (3.5 y) (print)   ?   1 C! I like it! Mon Apr 24 2000 at 2:35:45

A hash function is a mathematical function that takes an input value, and produce a smaller value in some particular range. The hash function is considered good if the distribution of values in the smaller range is uniform for the anticipated values in the source space.

The input values will commonly be a representation of a string (a message or a key.)

Hash functions are commonly used in computer programming for efficient searching; by hashing an input value, you get a smaller number, which can be used as an index into a table. The original values are then usually stored as a linked list under each hash entry.

For some more specialized cases of hash functions, see Secure Hash Functions and Perfect Hash Functions.


(thing) by -brazil- (2.5 y) (print)   ?   I like it! Tue May 22 2001 at 5:32:35

The most primitive hash function is a simple modulus. However, it fails all the requirements of a secure hash function, and it's not even advisable to use it for a hash table because it doesn't defend well against skews.

But most good cryptographic hashing algorithms (like SHA-1 or MD5) are not particularly complex either, and if they were, that would actually make them less secure. Why? First, security through obscurity is not much security at all. A cryptographically "hard" algorithm usually depends on some kind of trapdoor function, which has been thoroughly examined by mathematicians. If none of them found a way to reverse it, you assume that there is no way. However, the more complex the algorithm is, the more likely it is that it actually has some weaknesses that just hasn't been found yet (or, worse, has only been found by the NSA or similar agencies).


(idea) by DrT (1 y) (print)   ?   1 C! I like it! Fri May 31 2002 at 18:07:18

One example of a hash function is that used by the programming language Perl. This hash function is used by Perl (prior to version 5.6) to produce integer indices for associative arrays (aka hash tables) the programmer defines in a Perl program.

Here's an implementation of it in C. Here, the char* pointer str points to an ASCII string which is the textual index given by the programmer which we assume has already been given a value.

/* variable definitions */
unsigned int hash = 0;
unsigned long int len = strlen(str);
char *s = str;

/* make the hash */
while (len--) {
        hash = (hash * 33) + *s;
        s++;
}

Perl then folds the given value such that it is less than the size of the array.


printable version
chaos

Perfect Hash Functions secure hash mod-n function cryptographic primitives
Hashing MD5 hash function trapdoor function hash
hash table Mod 11 md5sum EDB Has a Posse
hash collision algorithm crypt Adler32 Checksum
Skew Hash trap Handbook of Applied Cryptography Wide trail strategy
Evangelion Anarchist's Cookbook MD5 Ross Anderson
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help


cooled by wharfinger

Cool Staff Picks
After stirring Everything, these nodes rose to the top:
Alcoholism
So, you want to change your hair color? Read this first!
Panopticism
Nintendo DS
Lawrence Textile Strike
chemotaxis
poppy
A duck meets God at a bar
Gospel of Thomas
Care instructions for the Juniper Bonsai
Trappist beers
Apocalyptic Themes in American Film
Nate on the Voting/Experience System
New Writeups
Glowing Fish
The Uncanny X-Men and the New Teen Titans(thing)
WolfKeeper
Launch loop(idea)
TendoKing
Katana(person)
Wuukiee
Highly ornamental cultivars of brambles still have as many thorns as their wild counterparts(idea)
TheDeadGuy
Editor Log: May 2008(log)
everyday j.Lo
pray do not molest them(thing)
ammie
Bands Who Take Their Names from Eighteenth-century English Poetry and Prose(idea)
shaogo
Under My Thumb(review)
ammie
Rock On(person)
The Custodian
The Dresden Files(thing)
Ouzo
PETA becomes you, a proposed future(fiction)
Ereneta
Stone Soup, Part Two(fiction)
jjen
Sorrier than I ever thought I would be(personal)
locke baron
Moskva class antisubmarine cruiser(thing)
Wuukiee
May 15, 2008(idea)
This page courtesy of The Everything Development Company