-
Hash Function - Hash is referred to the combination of albhabets and numeric value , use to represent the input command in the blockchain . The most important feature of hash is that , it cannot be same for diff inputs . Means every input has a unique different hash value . Also , hash function is a one way process where you cant figure out the input command by just knowing the hash value .
-
In bitcoin we uses SHA 256 hash function.
-
Collision resistant means that every input command should have a unique output hash value even if the input difference is minor or unnoticeble . There shouldnt be any collision of same hashvalue for different inputs .
-
A hash function takes strings of data and converts them into a set number of randomized/based on characters. It gives an irreversible fingerprint for the data.
-
Hash function are used in cryptocurrencies like bitcoin by making unique hash numbers for each block which increases security by not accepting a certain string. Also it is hard to make up a plausible output humanly.
-
Collision resistance is the concept that it is hard to find two inputs or more that correspond to one output in a hash function.
-
hash functions is a one way function (input to output) which each input is converted into a unique 256bits digital print.
-
in Bitcoin the input is the transaction of any length that run through a hash algorithm SHA256 which always gives an output of a fixed length.
-
collision resistant means that the probability of 2 or more different inputs to transform into the same output finger print is infeasible, if not impossible.
Thank you, itās understandable!
Very nice and well described!
Hash functions are not used to create keys, for that we use other algorithms like the elliptic curve
Collisions donāt have much to do with the way blocks are mined or nonces. It is the possibility for a hash function to generate the same output from two different inputs. Using a hash function that mitigates this though is crucial for creating blocks.
While public keys are indeed hashed (thatās how we get the address) it is not for the reason of security. We just do it to make the keys a bit smaller (public key has 65 bytes and address is only 20 bytes).
The main reason we use hash functions is to cryptographically link blocks in a chain
Why do we use it though?
This is how we get the txid. Do you know any other more important reason why we use hash functions?
-
a method of incrypting data into numbers which is deterministic (input always produces same output), preimage resistant (infeasible to reverse engineer from the output hash to the original input), collision resistant (infeasible for two distinct inputs to produce the same output hash), puzzle friendly (meaning though difficult to solve, is easy to check, for mining only?), any change to the input changes the hash output, and quick.
-
they are used to provide the security and immutability which makes for the trust-less environment of the currency. also for mining.
-
collision resistance is necessary for security and traceability. it means the odds of any input having the same output hash are negligibly low. if it does occur, numerous up and downstream checks exists within the block chain system as to alert all users within the network, and gain back security immediately.
- Describe hash functions with your own words
- Is a one way, non reversable, function which gives an unique fixed length result from a variable length input
- How are hash functions used in cryptocurrencies like bitcoin? (Try to research this on your own, we will cover this later in the course but challenge yourself and see if you can find information on this already now).
- It protech each linked block by calculate the hash of the concattenation of the block version number, current timestamp, current difficulty target, hash of previous block, the Nonce (a random string) and the hash of the merkle root (to easily find a data back)
- What does it mean when we say that hash functions need to be collision resistant? (We didnāt use the term ācollision resistantā in the lecture, but you will easily find this on Google, we add this question intentionally to make you research information on your own, thatās how you learn best).
- Since there are more then 2^256 possible inputs, it is possible to get same output again, but negligible
Q1. Describe hash functions with your own words
Hash functions are mathematical functions which generate a unique output of fixed length - digital fingerprint for a given input of any length.
Hash functions enable secure transmission of message by preventing tempering of the message.
Hash functions are fundamental to creation of blockchain.
Cryptographic functions have below properties to make blockchain secure:
Property 1: Deterministic
Property 2: Quick computation
Property 3: Pre-Image resistance
Property 4: Small changes in the input changes the hash
Property 5: Collision resistance
Property 6: Puzzle friendly
Q2. How are hash functions used in cryptocurrencies like bitcoin?
Creation of public key, digital signature and wallet address.
Bitcoin block consists of:
Hash of previous block header
Hashed transactions (Merkle Root)
Bitcoin mining:
(a) hashing contents of the block before being added to the blockchain
(b) hashing of nonce (random string) appended to the hash of block contents (a) for comparison with the difficulty level
Q3. What does it mean when we say that hash functions need to be collision resistant?
Hash functions must be collision resistant so that it is not feasible to generate same output for two or more given inputs.
Hash functions are not used to derive the public key, for that we use the elliptic curve. But the public key is hashed to get the address
- A hashfunction takes any input, of any length, and convert it into a certain format. In the case of BTC, therefore SHA-265, it converts any length of input into an unique 256 bit output.
- The hash of an input, therefore the output is used as an input for the next block. The hash of the previous block is used as an input in the current block, this ensure that the data (or input) is correct and valid.
- The hashfunction of two different inputs are the same, this can happen but the probability is EXTREMELY low.
Hash functions in Bitcoin are used in a specific way, in order to insure its cryptographic qualities. This includes ācollision resistanceā, which makes it astronomically difficult, to generate two exact outputs from two different inputs. Another feature is that the cryptographic hash, mathematically āhidesā some of the inputās information.
Collision Resistance in cryptography, uses a specific set of hash functions called a Merkle Tree. So the mined blocks, which are mined by the miners, are then combined in sets of two; to produce a hash that itās 64 characters long and it is deterministic. This means that as long as the initial data is not changed, it will always produce the same outcome. Due to its astronomical size of the SHA-256 algorithm, makes it infeasible, through brute force, to find an output produced by two different inputs⦠in the resulting hash.
ANSWERS:
-
Hash functions is an equation that takes the data you are inputting and giving you a unique output that pertains to it; it is very sensitive, changing from lower to uppercase, while using the same characters, will give you a different outcome.
-
In cryptos, hash functions are used to mine new blocks. I believe this is only for proof of work concepts, but I havenāt gotten that far in the course yet, so weāll see.
-
In order for hashes to be collision resistant, you would have to be able to provide two different inputs that do not give you the same output.
- basically takes input and generate output, differences between hash algorithms are security. for example sha256 takes input and generate unique fixed-length output which is in hexadecimal numbers.
- hash function sha256 is securing btc via set of properties (Deterministic, Quick Computation, Pre-Image Resistance, Collision Resistant, Puzzle Friendly)
- collision means same output from different inputs. collision resistance mean preventing this to happen
Thanks for letting me know! I mustāve misunderstood something. Iāll definitely look into it more.
The public key derived from elliptic curve is further hashed twice by SHA256, RIPEMD160 hashing functions and then given for public use.