Hash Pointers and Data
structures, Hash
Functions
Module 1
Hash Pointer - DS
Hash Pointer - DS
• A hash pointer is simply a pointer to where some information is stored together with a cryptographic hash of
the information.
• Whereas a regular pointer gives you a way to retrieve the information, a hash pointer also gives you a way to
verify that the information hasn’t changed.
Hash pointer. A hash pointer is a pointer to where data is stored together with a cryptographic hash of the
value of that data at some fixed point in time.
• Block chain. A block chain is a linked list that is built with hash pointers instead of pointers.
• Tamper-proof logs Ensuring that personal data are only accessed by
authorized users— and for authorized purposes
• So we can build a block chain like this containing as many blocks as we want, going back to some special
block at the beginning of the list, which we will call the genesis block .
Tamper‐evident log. If an adversary modifies data anywhere in the block chain, it will result
in the hash pointer in the following block being incorrect. If we store the head of the list, then even if
the adversary modifies all of the pointers to be consistent with the modified data, the head pointer
will be incorrect, and we will detect the tampering.
• Merkle trees. Another useful data structure that we can build using hash pointers is a binary tree. A
binary tree with hash pointers is known as a Merkle tree , after its inventor Ralph Merkle
• Merkle tree. In a Merkle tree, data blocks are grouped in pairs and the hash of each of these blocks is
stored in a parent node. The parent nodes are in turn grouped in pairs and their hashes stored one level up
the tree. This continues all the way up the tree until we reach the root node.
• Proof of membership. Another nice feature of Merkle trees is that, unlike the block chain that we
built before, it allows a concise proof of membership. Say that someone wants to prove that a certain data
block is a member of the Merkle Tree. As usual, we remember just the root. Then they need to show us this
data block, and the blocks on the path from the data block to the root. We can ignore the rest of the tree, as
the blocks on this path are enough to allow us to verify the hashes all the way up to the root of the tree.
Cryptography Hash Functions
• Process that turns plaintext data of any size into a unique ciphertext
of a predetermined length.
• A cryptographic hash function (CHF) is an equation that is widely used
to verify the validity of data
• A cryptographic hash function is a single-directional work, making it
extremely difficult to reverse and recreate the information used to
make it.
• In data structures, hash functions are primarily used in hash tables,
which are essential for efficient data management.
• The output, typically a number, is called the hash code or hash value.
Properties of hash functions
• Hash functions have several properties, including:
• Determinism: The same input always produces the same output.
• Collision resistance: It's computationally difficult to find two different inputs that
produce the same output.
• Preimage resistance: It's computationally difficult to create an input that produces a
given output.
• Avalanche effect: Small changes to the input produce significant changes to the output.
• Non-reversibility: It's difficult to reconstruct the original input from the output.
• Non-predictability: The output is not predictable from the input.
• Efficiency: The output is computed quickly, regardless of the input size.
• Puzzle-friendly: This property makes it difficult to find a solution, to a problem without
using brute force. This is important for proof-of-work, such as in bitcoin mining.
Collision Resistance Hash
Puzzle Friendly Hash
Thank You