StartKryptowährung NewsWhat are the Hash Functions?

    What are the Hash Functions?

    What are the Hash Functions?

    The term is derived from the French word “hacher” which means to “chop into small pieces”. Generically speaking, a hash is a mathematical function that converts an input of arbitrary length into an encrypted output of a fixed length. Thus regardless of the original amount of data or file size involved (to “map”), its unique hash will always be the same size, a given set of data into a bit string of fixed size, known as the „hash value.“ If you use a function on the same data, its hash will be identical, so you can validate that the data is the same if you already know its hash.

    Hashing is also essential to blockchain management in cryptocurrency.

    Hash Functions, in pills:

    • Hash functions are mathematical functions that transform or „map“ a given set of data into a bit string of fixed size, also known as the „hash value.“
    • Hash functions are used in cryptography and have variable levels of complexity and difficulty.
    • Hash functions are used for cryptocurrency, password security, and message security.

    How do Hash Functions work:

    Hash functions are commonly used data structures in computing systems for tasks, such as checking the integrity of messages and authenticating information. While they are considered cryptographically „weak“ because they can be solved in polynomial time, they are not easily decipherable.

    Cryptographic hash functions add security features to typical hash functions, making it more difficult to detect the contents of a message or information about recipients and senders.

    In particular, cryptographic hash functions ideally exhibit these three properties:

    • They are “collision-free.” This means that no two input hashes should map to the same output hash.
    • They can be hidden. It should be difficult to guess the input value for a hash function from its output.
    • They should be puzzle-friendly. It should be difficult to select an input that provides a predefined output. Thus, the input should be selected from a distribution that’s as wide as possible.

    A hash function turns an input (for example text) into a string of bytes with a fixed length and structure. The output or value created is called a “hash value” or “checksum”. Any hash value created from data using a specific hashing algorithm is always the same length and one-way – it cannot be reversed.

    Image by Wikipedia

    Properties of hash functions

    A hash function is any deterministic function that takes an input of arbitrary length and produces a fixed-length output, which is referred to as the “hash digest”. Blockchains rely heavily on hash functions for generating cryptographic keys and hashing the transaction blocks.

    Read more: Blockchain – Eine Erklärung für Entscheider

    General Properties:

    • Fixed Length Mapping
    • Deterministic
    • Efficiently Computed

    Cryptographic Properties:

    • Preimage Resistance
    • Collision Resistance
    • Avalanche Effect
    • Puzzle Friendliness
    • Fixed Length Mapping

    For input of any length, the function will always generate a fixed-length output. This property allows us to hash any file whether it is a text document, image or even a video file and get the output of the same length. There are multiple Hashing Functions out there like SHA-256, Keccak-256, etc.

    For example, Bitcoin platforms largely rely on SHA-256: it takes in the input of any length and converts it into 256 bytes. This means that you can literally hash an entire movie into just 256 bytes.

    Deterministic: For a given input, the output will always be the same. So, if I hash the word ‘hello’ using the SHA-256 hash function, then I will always get the same output.

    So, mathematically, we can say for a given ‘X’, Hash(X) will always be the same.

    Efficiently Computed: the hashing algorithm should be so efficient that you can compute hashes on an ordinary Laptop or PC using just your CPU cores. Not all hash functions are cryptographic hash functions, rather only the functions that exhibit the following cryptographic properties can be called “cryptographic hash functions”.

    Preimage Resistance:given the output of the hash function (hash digest), you cannot determine the input. Therefore, if someone hashes a message and sends it to another, then even if they get a hold of the hash digest, they will not be able to decrypt what the original message was.

    Mathematically, we can say that given Hash(X), you cannot determine X

    Read more: Was ist Blockchain-Hashing? – Hardware-Inside Forum

    Collision Resistance: for two distinct inputs, the output of the hash function should not be the same.

    Mathematically, we can say that for 2 distinct inputs X1 and X2, Hash(X1) should not be equal to Hash(X2)

    Avalanche Effect: it means that for a small change in the input, there will be a significant change in the output of the hash function.

    Puzzle Friendliness: even if you get hold of the initial 200 bytes, you cannot determine the next 56 bytes from it. With the introduction of hash functions out of the way, now let’s look at how they are used in leading cryptocurrencies.

    A cryptographic hash function should be computationally efficient: it must be quick in performance to create the hash value. It has to be deterministic – every time you put in a certain input, it has to produce the same output and to be pre-image resistant which means it cannot reveal any information about the input in the output.

    Finally, a hash function has to be collision-resistant which ensures that it has to be impossible for two different inputs to produce the same output. It is the deterministic feature, pre-image resistance and collision-resistance that constitute the three most important properties of hash functions in the Bitcoin mining process.

    A hash function has to be collision-resistant which ensures that it has to be impossible for two different inputs to produce the same output.

    The usage in the mining process and the outcome

    Any block is bundled and contains several transactions as well as information on the previous block. This means if someone wanted to change the ledger or double-spend (the risk that a cryptocurrency is used twice or more) a transaction, they would have to change the hash in all previous blocks.

    In order for the bundled block to be added to the blockchain, miners need to find a hash that meets the target difficulty. Each block contains a blockheaded with the number of the block, the hash of the previous block and a “nonce”, which includes a timestamp. The purpose of a nonce is varying the input to a cryptographic hash function, that is increased randomness, in computation during the mining process.

    Read more: Was ist eine Blockchain Hash Funktion? Hash einfach erklärt!

    The node then begins “hashing” the data by converting it into the hash value or “hash”, which always needs to contain a certain number of zeros. The node checks whether a hash meets the criteria of difficulty. The hash must start with the correct number of zeroes.

    If the hash meets the criteria of difficulty, it is broadcast to the other miners in the network. The first miner to find a valid hash validates the block into a new block and gets rewarded the block reward and fees in Bitcoin.

    If the hash does not meet the criteria of network difficulty, another nonce is selected and hashed. Miners probably have to generate many hashes with many nonces until they find a nonce that meets the difficulty. This is the repetitive and energy-intensive process known as Bitcoin mining which requires extensive computational power.

    Hash functions constitute the backbone of the Proof of Work process.

    Without confirmation and production of hash transactions, the blockchain would not be tamper-proof and inalterable and it would not be possible to prove who owned which amount of Bitcoin at what time.

    Based in Zug, the platform is fully compliant with all Swiss laws related to financial intermediaries, banking, anti-money laundering, and organized trading facilities. Among its core values, there are innovative solutions through blockchain technology, which ensures security and liquidity.

    EDSX is the first platform in Europe with primary and secondary markets for both institutional and retails. EDSX is a pioneering platform that employs the world’s leading technology to globally list security tokens in both primary and secondary markets, listing digital securities of real financial instruments to the public with a decentralized peer-to-peer exchange. Our goal is to fully compromise every aspect of the financial revolution.

    Do you have a question for us?

    Send your query here:

    Read more: Blockchain hash – Krypto-NFTs

    Source: 🔗