A "hash" is a generic term for a bit of software that - given the same input - will produce the same output, and where the input cannot be reconstructed by looking at the output. For example, given the input of "23" a very simple hash would be "5" (adding them together). In this case you cannot reconstruct "23" by analysing "5" because other inputs will also equal "5" ("41", for example). Although you cannot reconstruct the input, you can verify that the input matches the hash.

The use of hashes in applications is typically used to store passwords because if the password database is stolen and your inputs (passwords) are hashed then the thief can’t feasibly reconstruct the input (the original passwords) and use them in the future. So as well as the thief not having anything useful, it means you don’t need to tell all the customers to change their passwords. Because you're only storing the hash of a password this does mean you can’t tell customers what their password is – you can only change it.

When two inputs make the same output in a hash this is called a collision. Just before "23" was hashed as "5" but "41" would also be "5". Collisions in hashes are to be expected; a mere collision is no big deal. However the output of a good hash is also supposed have some other properties – if a good hash produces a value between 0000 and 9999 it shouldn’t produce twice as many outputs between 8000-9999 – the output should be equally distributed across the output space. Also, a good hash given the input "password" and "pbssword" (which vary by only a single letter) should produce very different outputs. This should apply to all inputs, not just typical inputs.

For example, "password" in the MD5 hash is 5F4DCC3B5AA765D61D8327DEB882CF99. Whereas "pbssword" is 65ADD8ADCD26EA1AF12B05F67FD50B97.

This change in output is important because if I already know 5F4DCC(...) as being the hash of "password" this shouldn't help me work out that 5F4DCB(...) came from an input near the word "password".

Finally, a good hash should make it computationally infesible to construct a possible input. If a hash's output varies only between 1 and 9 then generating a possible input is easy, so this is not a good hash. Good hashes like SHA-1 would take years of computer time to construct a possible input (as currently known). Unless you're a crypto scientist use an established and researched hash.

When using hashes in your applications it's important to remember that hashes are repeatable (given the same input you'll get the same output) and that there are precalculated databases of hashes and popular inputs (popular passwords, english words, etc - and their resulting hashes). These databases could be used for good or bad, but as you're hashing your passwords in the first place you'll be wanting to defeat these databases.

One method of defeating such databases is by salting your input. For example, before hashing the word "password" you might combine "salted" so as to get "saltedpassword" -- producing a hash that the precalculated database is less likely to have (it'll have the hash for "cat" but it's less likely to have "saltedcat"). You can either add your salt at the beginning, or intermingle your letters. You may even decide to add specific bytes onto your input so your salt isn't English. Salting could be done application-wide, or per-user (have a salt column in your user table).

Popular hashes are MD5, SHA-0, and SHA-1. Recently MD5 and SHA-0 were shown to be significantly easier to computationally
So use SHA1 (or greater) as your hash and keep an eye out for recently discovered flaws in hashing algorithms. And as hashes vary in length be sure that your database doesn't truncate your good work in protecting passwords.
Did you salt your hashes?

What hashing algorithm did you use?
by Matthew Cruickshank August 25, 2004
10 Words related to hash
Top Definition
Hash (hashish) is the resin collected from the flowers of the cannabis plant. The primary active substance is THC (tetrahydrocannabinol) although several other cannabinoids are known to occur.

Hash is usually smoked in pipes, water pipes, joints, and hookahs, sometimes mixed with cannabis flowers or tobacco. It can also be eaten.

The most common effects of hash and cannabis are: a sense of wellbeing, relaxation, rapid flow of ideas, increased appreciation of music and food, heightened senses, sleepiness, pain relief, nausea relief and increased appetite.

There are also several negative effects including dry mouth, rapid heart beat, impaired short term memory, anxiety, and panic attacks.

Contrary to popular belief, the effects from smoking cannabis or hash are not increased by holding the smoke in the lungs longer. Almost all of the THC is absorbed within the first few seconds. Also contrary to popular belief, more potent cannabis or hash is not more dangerous. Users generally take enough of the substance until they achieve the desired effects. In the case of smoking, it means the user will have to inhale less smoke and therefore fewer toxins to achieve the same effect.

Most high school students report that it is easier for them to obtain cannabis than alcohol. This is possibly due to the fact that people who sell cannabis are already breaking the law and have few problems with selling to minors. Despite ever-increasing spending on prosecution of cannabis users and anti-drug misinformation, some 50% of high school seniors report having tried cannabis.

Hash is currently illegal in countries where the government feels it is best to make decisions for an individual, including what consenting adults do in the privacy of their homes.
Hash should be regulated and sold like alcohol.
by Anonymous October 01, 2003
The concentrated resin from the tops of female marijuana plants.
I picked a gang of bud from my plants and rolled the hash from my fingers. We smoked it and got sooooo high!
by Holoman May 07, 2003
Compressed Trichomes derived usually from the female Cannabis plant.

Hash is a very strong type of Marijuana, that is usually made from rubbing bud over a sieve like mesh, fine screens basicly.

Trichomes are the ' crystals ' on cannabis plants that contain THC, THC being the only active chemical on Cannabis plants, and Trichomes being the only things on Cannabis plants that contain THC.

Trichomes look like tiny transperent mushrooms when magnified. Strong weed usually has alot of visible Trichomes giving buds a ' frosty ' type look sometimes.

People in-correctly refer to trichomes as ' crytals 'or ' pollen '

hashish is made from removing these trichomes, ( also Resin ) from female cannabis plants and compressing them into small blocks which can be eaten or smoked, or even made into tea, or mixed with alcohol to increse effects and to mix both the high, and the 'drunk '.

Hash or Hasish is usually VERY strong, usually espensive and hard to find.

Hashish is alot like Marijuana, tastes almost exactly like Marijuana in most cases, if made properly.

" Dude, you wanna fly? "
" how? "
" Its called Hashish "

Dealer: " What you want? "
Buyer: " only the best "
Dealer: " hashish it is! "
#marijuana #cannabis #hashish #pot #weed #grass #reefer #buhda #420
by MullMan December 23, 2007
An extract of marijuana made up of resin you smoke it but it is not the same fucking thing as weed .... if you thought it was you've probably never smoked weed... honestly weed and hash are not fucking synonyms
lets go smoke a bowl of hash
by REED June 10, 2003
1. An algorithm whose arguments are converted into a fixed-length representation called a digest. Hashes are usually used for sensitive data because the results are irreversable.
2. The pound/oglethorpe sign (#), used by many computer languages to denote the start of a single line comment block.
3. Slang for hasish, an extract from the resin of marijuana plants. This resin is usually many times more potent than the plant material acquired from such plants.
4. One of two lateral dashed lines on a football field. Hash lines are usually placed in a way that divides the field into thirds.
1. Use an md5 hash to store my password.
2. A hash followed by a bang and an application path is a directive which may be used to determine how a shell script is handled.
3. Coach gets made at me when I smoke his hash.
4. When Coach gets mad, I shit on the hash lines.
by ravingidiot August 25, 2004
A piece of light or dark firmly pressed resin from the cannabis plant. Gets you more stoned than high. Much stronger than weed, regardless what some people at urbandictionary claim. When you smoke a hash joint, you use around 0,7 grams of good quality hash mixed with 1 toasted cigarette.

Some of the best hash in the world is from Morocco, India and Lebanon.
pot is weak. hash is strong
#hash #hashish #cannabis #weed #joint
by hashishisgoodforyou March 29, 2008
The sound that certain grannies make when they sneeze- can be used in everyday conversation as well as words that rhyme with HASH!
me: I was thinking of making bangers AND MASH but I had a CRASH in HASHpierpoint!

Granny H: Oh HASH!I better DASH off!
#granny #sneeze #dash #mash #flash
by hen123 December 10, 2011
Free Daily Email

Type your email address below to get our free Urban Word of the Day every morning!

Emails are sent from daily@urbandictionary.com. We'll never spam you.