0% found this document useful (0 votes)
11 views12 pages

String Hash Functions Overview

The document discusses hash functions, which map data of arbitrary size to fixed-size values, and highlights their importance in data integrity. It outlines the basic properties of a good hash function, including speed and minimizing collisions, and addresses issues related to string length and hash value size. Additionally, it briefly mentions enhanced hashing techniques such as DJB, FNV, and Murmur.

Uploaded by

Shuvom Datta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views12 pages

String Hash Functions Overview

The document discusses hash functions, which map data of arbitrary size to fixed-size values, and highlights their importance in data integrity. It outlines the basic properties of a good hash function, including speed and minimizing collisions, and addresses issues related to string length and hash value size. Additionally, it briefly mentions enhanced hashing techniques such as DJB, FNV, and Murmur.

Uploaded by

Shuvom Datta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

String Hash Function

Dr. Ripon Patgiri


Dept of Computer Science & Engineering,
National Institute of Technology Silchar
Introduction

A hash function is any function that can be used to map data of
arbitrary size to fixed-size values, though there are some hash
functions that support variable length output.


The values returned by a hash function are called hash values,
hash codes, hash digests, digests, or simply hashes.


Hash functions are related to (and often confused with) checksums,
check digits, fingerprints, lossy compression, randomization
functions, error-correcting codes, and ciphers.


Although the concepts overlap to some extent, each one has its own
uses and requirements and is designed and optimized differently.


The hash function differs from these concepts mainly in terms of
data integrity.
String Hash Function
A hash function may be considered to perform three functions:

1. Convert variable-length keys into fixed length (usually machine word length or
less) values, by folding them by words or other units using a parity-preserving
operator like ADD or XOR.
2. Scramble the bits of the key so that the resulting values are uniformly
distributed over the keyspace.
3. Map the key values into ones less than or equal to the size of the table.
Properties

A good hash function satisfies two basic properties:

1. It should be very fast to compute


2. It should minimize duplication of output values (collisions)
Basic string hash function

Issues: Two different strings can be easily mapped into single a hash
value.
String Hash Function

Issues: Long strings creates very large number.


String Hash Function

Issues: Small length string has small sized hash value


Enhanced hashing
DJB

Issues: Small length string has small sized hash value


FNV

Issues: Small length string has small sized hash value


Murmur
https://github.com/
aappleby/smhasher
Thank you

You might also like