The document provides an overview of hash tables, including how they store key-value pairs using hashing to map keys to indexes. It discusses hashing functions and how they should be stable, uniform, efficient and possibly secure. It describes how hash tables handle collisions through open addressing or chaining and how items can be added, removed, searched for and enumerated from a hash table.
Hashing notes data structures (HASHING AND HASH FUNCTIONS)Kuntal Bhowmick
A Hash table is a data structure used for storing and retrieving data very quickly. Insertion of data in the hash table is based on the key value. Hence every entry in the hash table is associated with some key.
HASHING AND HASH FUNCTIONS, HASH TABLE REPRESENTATION, HASH FUNCTION, TYPES OF HASH FUNCTIONS, COLLISION, COLLISION RESOLUTION, CHAINING, OPEN ADDRESSING – LINEAR PROBING, QUADRATIC PROBING, DOUBLE HASHING
hashing is encryption process mostly used in programming language for security purpose.
This presentation will you understand all about hashing and also different techniques used in it for encryption process
The presentation is an introduction the hash algorithm application, dealing with random data and sorting it for fast accessing and implications with normal hashing techniques.
Hashing notes data structures (HASHING AND HASH FUNCTIONS)Kuntal Bhowmick
A Hash table is a data structure used for storing and retrieving data very quickly. Insertion of data in the hash table is based on the key value. Hence every entry in the hash table is associated with some key.
HASHING AND HASH FUNCTIONS, HASH TABLE REPRESENTATION, HASH FUNCTION, TYPES OF HASH FUNCTIONS, COLLISION, COLLISION RESOLUTION, CHAINING, OPEN ADDRESSING – LINEAR PROBING, QUADRATIC PROBING, DOUBLE HASHING
hashing is encryption process mostly used in programming language for security purpose.
This presentation will you understand all about hashing and also different techniques used in it for encryption process
The presentation is an introduction the hash algorithm application, dealing with random data and sorting it for fast accessing and implications with normal hashing techniques.
At the beginning, the number of elements in a set of numbers to be stored in a computer system used to be not so large or having a wide range. Then, using a
simple table T [0, 1, ..., m − 1]called, direct-address table, could be used to store those numbers. As the situation became more and more complex, and a new idea came to be:
Definition
An associative array, map, symbol table, or dictionary is an abstract data type composed of a collection of tuples {(key, value)}
This can bee seen in the example of dictionaries in any spoken language. The problem became more complex when the range of the possible values for the
keys at the tuples became unbounded. Therefore a new type of data structure is needed to avoid the sparsity problem in the data, the hash table.
Data Structure and Algorithms: What is Hash Table pptJUSTFUN40
Outline:
What is a HASH TABLE?
What is a HASH FUNCTION?
What is a HASH COLLISION?
Implementation of a Hash Table
Discussion on collision resolution methods in particular SEPARATE CHAINING and OPEN ADDRESSING
Separate Chaining Implementation
Open Addressing Implementation
Linear Probing
Quadratic Probing
Double Hashing
Data to be Signed: Suppose you have a message or data that you want to sign to prove its authenticity and integrity.
Hashing: First, this message is subjected to a cryptographic hash function (commonly SHA-1, SHA-256, or similar). The purpose of this step is to produce a fixed-length hash value, which represents the unique fingerprint of the data. The hash value is considerably shorter than the original data.
Signing: The DSA algorithm then uses this hash value to create a digital signature. The signature is generated using the private key of the signer and some mathematical operations.
Verification: The recipient of the data, who has access to the corresponding public key, can use the same cryptographic hash function to generate a hash value from the received data. They then use the sender's public key to verify the digital signature.
2. Outline
S Hash Table Overview
S Hashing Overview
S Add Items
S Remove Items
S Search For Items
S Enumerate Items
3. Hash Table Overview
S Associative Array
S Storage of Key / Value Pairs
S Like an array, but the index can be any comparable type
S Each Key is Unique, though Keys can point to the same
value
S The Key Type is mapped to an Index
4. Hashed???
S Hashing derives a fixed size result from an input
S every hash returns same size and type
S Stable
S The same input generates the same output ALWAYS
S Uniform
S The hash value use should be uniformly distributed through available
space (though impossible to have perfect uniformity)
S Efficient
S The cost of generating a hash must be balanced with application needs
S Secure
S The cost of finding data that produces a given hash is prohibitive
5. Hashing A String
S Naïve implementation
S Summing the ASCII value for each character
F O O 102 111 111 324
S Pros
S Stable
S Efficient
S Cons
S Not Uniform
S AdditiveHash(“foo”) = AdditiveHash(“oof ”)
S Not Secure
6. Hashing A String
S Somewhat better
S “Folds” bytes of every four characters into an integer (32bit)
Lore m ip sum dolo r
170199844 1885937773 54404403 1869377380 114
-707031079 -162986676 1706390704 1706390818
S Pros
S Stable, Efficient and better uniformity
S Cons
S Not secure (can be treated essentially as additive)
7. Hashing Functions
S There are lots of good hashing algorithms, you don’t have to write
your own.
S Pick the right hash for the job at hand (all these are available in the
.net framework)
Name Stable Uniform Efficient Secure
Additive ✔ ✔
Folding ✔ ✔ ✔
CRC32 ✔ ✔ ✔
MD5 ✔ ✔
SHA-2 ✔ ✔ ✔
8. Hash Table Overview
S Adding Jane
S int index = GetIndex(Jane.Name);
S _array[index] = Jane;
S What does GetIndex() do? It hashes the string
10. Handling Collisions
S Two distinct items have the same hash value
S Items are assigned to the same index in the hash table
S Two common strategies
S Open Addressing
S Moving to next index in the table
S Chaining
S Storing items into a linked list
S Frequency of Collisions
S # of slots in the array
S # of filled slots in the array
11. Finding Items
S Items are found by key
S Person p = HashTable.Find(“Jane”)
S Open Addressing
S Get the index of the key
S If the value != null
S If keys match, return value
S If keys don’t match, check next index
S Chaining
S Get index of the key
S Find index in the list
12. Removing Items
S Items are removed by key
S HashTable.Remove(“Jane”)
S Open Addressing
S Get index of the key
S If value != null
S If keys match, remove
S If keys don’t match, check next index
S Chaining
S Get index of the key
S Remove item from the linked list
13. Enumerating Keys & Values
S Open Addressing
S Foreach(item in array)
{if(item!=null) return item;}
S Chaining
S Foreach(list in array)
{if(list !=null)
{foreach(item in list){return item;}}
}