Cryptographic Hash 101

A cryptographic hash function is a hash function that satisfies the properties of pre-image resistance, second pre-image resistance and collision resistance. Here, a hash function is a mathematical algorithm that maps data of an arbitrary size (or “message”) to a bit array of a fixed size (the “hash value”, “hash”, or “message digest”), that is, a function that takes a string of any size as input and produces a fixed length value.

Pre-image resistance
Given a hash value h, it should be difficult to find any message m such that

h = hash(m)

Second pre-image resistance (weak collision resistance)
Given an input m1, it should be difficult to find a different input m2 such that

hash(m1) = hash(m2)

Collision resistance (strong collision resistance)
It should be difficult to find two different messages m1 and m2 such that

hash(m1) = hash(m2)

A pair of messages that has the same hash value is called a cryptographic hash collision.

Similar Posts

  • Hashing Library for C

    I try to find some Hashing libraries for C and find several good ones. The hsearch function in the GNU C library. There are other methods to organize information which later should be searched. The costs of insert, delete and search differ. One possible implementation is using hashing tables. The following functions are declared in…

  • How to get the git commit tree?

    How to get a tree-like view of the git commit history? My favorite command line: git log –graph –oneline It will prints a text based graph like (with colors): * b5dc8b9 Merge branch ‘master’ of https://github.com/layerzero/libi0 | | * 7514ef1 revised the README.md a little bit | * 6692428 align size to page for both…

  • Compress PNG Images on Linux

    PNG images already use DEFLATE data compression algorithm involving a combination of LZ77 and Huffman coding. But the PNG images can be further compressed by removing non-important metadata or using lossy compression to save storage space and/or data transfer bandwidth. In this post, we introduce 2 compression ways with tools available on Linux. Lossless compression…

  • NFT 101

    What is NFT? Non-Fungible Token (NFT) is a kind of blockchains. What distinguishes NFTs from fungible , and ownership of the NFT is often associated with a license to use the underlying asset. There are standards or convensions for NFTs on blockchain. For example, ERC-721 is a standard for representing non-fungible digital assets on the…

  • Implementation of strstr in glibc

    What is the implementation of strstr in glibc? Implementation of STRSTR in glibc (string/strstr.c): /* Return the first occurrence of NEEDLE in HAYSTACK. Return HAYSTACK if NEEDLE is empty, otherwise NULL if NEEDLE is not found in HAYSTACK. */ char * STRSTR (const char *haystack_start, const char *needle_start) { const char *haystack = haystack_start; const…

  • | |

    Installing Zlib in Ubuntu 22.04

    Zlib is a popular open-source compression library used by many software applications to compress and decompress data. It provides fast and efficient compression and decompression algorithms that can be used to reduce the size of data, which can improve performance and reduce storage requirements. In this post, we will discuss how to install zlib in…

Leave a Reply

Your email address will not be published. Required fields are marked *