What is a Cryptographic Hash Function? | Where & How It Is Used In Crypto (Animated)
Estimated read time: 1:20
Summary
The video delves into the concept of cryptographic hash functions and their importance in cybersecurity and cryptocurrency. It explains how passwords are stored as hashes to enhance security and discusses the functionality and characteristics of hashing functions. The video further explores different types of hashing functions, such as SHA-256, and their significance in logging in, generating public keys, transaction validation, and proof of work in crypto systems. It emphasizes the security benefits provided by these functions and their role in maintaining the integrity of blockchain transactions.
Highlights
- Passwords are stored as hashes, not plain text, for better security. 🔑
- Changing even a tiny bit of input data changes the entire hash. 🔄
- SHA-256 and other hash functions help secure transactions and public keys in crypto. 📉
- Merkle trees use hashes to ensure and verify transaction integrity in each block. 🌲
- Proof of work relies on miners solving hash puzzles to add blocks to the blockchain. 🧩
Key Takeaways
- Cryptographic hashes secure your passwords by storing them as unique, fixed-length strings. 🔐
- Hash functions are like magic boxes that transform any data into a consistent hash value. 🎩
- SHA-256 is the rockstar of crypto, playing a huge role in Bitcoin's security. 🌟
- Hash functions ensure data integrity and protect against unauthorized modifications. ✅
- Mining in blockchain relies on solving complex puzzles with hash functions. ⛏️
- Hashes connect the blockchain blocks, forming an unbreakable chain of data. 🔗
Overview
Ever wondered how your online security is maintained? That's where cryptographic hash functions come into play! These magical functions transform your password and other data into a unique series of numbers and letters known as a hash. This hash acts as a special key, ensuring that even if hackers breach a site, they can't uncover your actual password.
The realm of cryptocurrency also depends on these incredible hash functions. SHA-256, for example, is crucial in Bitcoin and Ethereum for generating public keys and transaction IDs, making transactions secure and trustworthy. Hash functions ensure autheniticity and integrity—change even a comma, and the whole hash and its meaning could change entirely!
But the magic doesn't stop there. In the world of crypto mining, hash functions power the proof of work system. Miners race to solve mathematical puzzles, where the fastest to produce a valid hash gets to add a block to the blockchain, earning rewards like Bitcoins. So next time you think of crypto, remember the unsung hash functions keeping everything safe and sound!
Chapters
- 00:00 - 01:30: Introduction to Cryptographic Hash Functions This chapter introduces the concept of cryptographic hash functions, particularly in the context of password security. It explains that passwords are not stored in plain text on servers to protect users across different sites. Instead, passwords are stored as hashes—an essential aspect of securing user information against hackers. The discussion sets the stage for a deeper dive into how these hashes work and what they entail for security and authentication processes.
- 01:30 - 03:00: Understanding Hash Functions The chapter titled 'Understanding Hash Functions' is focused on educating the reader about cryptographic hash functions. It introduces the topic by highlighting its relevance to cryptocurrencies and decentralized finance (DeFi). The chapter promises to answer several foundational questions related to hash functions, their characteristics, and their application in the realm of crypto. It is written in a way that aims to be simple and accessible for beginners interested in the field.
- 03:00 - 05:00: Properties of Hash Functions Hash functions are used to transform input data, such as passwords, into a fixed string of letters and numbers. Despite appearing random, these strings are a deterministic output based on the input data and the specific hash function used. The function ensures that even small changes in the input data result in vastly different output, enhancing security and integrity. Hash functions play a crucial role in maintaining password security.
- 05:00 - 07:30: Hash Functions in Cryptocurrencies Hash functions are described as complex mathematical 'black boxes' that convert any data into a fixed-length series of letters and numbers, known as a hash.
- 07:30 - 12:00: Conclusion Hash functions are not random; they use math to summarize input data, providing consistent results regardless of the number of attempts. Cryptographic hash functions are one-way, meaning once data is hashed, it cannot be reversed to reveal the original input data.
What is a Cryptographic Hash Function? | Where & How It Is Used In Crypto (Animated) Transcription
- 00:00 - 00:30 do you know that the passwords you create on most websites are not actually stored on the website servers in a text format as you may know many people use the same password for multiple accounts on many websites so your password is stored on a website servers and then these servers got hacked then the hacker can access all your other accounts with the same password so to protect users from hackers most websites store users passwords as hashes you may be wondering what is this hash and how do you log in if your password
- 00:30 - 01:00 is stored like this also what does all of this have to do with crypto well you will get answers to all these questions in a minute but first welcome to cryptobi where we explain cryptocurrencies and defy topics in the most simple and beginner-friendly way in this video you will know what is a cryptographic caching function some important characteristics of secure hashing functions and then we will get to where and how these hashing functions are used in crypto so let's get started
- 01:00 - 01:30 [Applause] [Music] so what is a hash function well to answer this question let's return to our passwords example now looking at this hash you may be thinking that these are some random letters and numbers but actually they are not random at all this hash comes from putting your password into a hashing function
- 01:30 - 02:00 this hashing function is like a black box that works using some very complex math to convert any data you give it into a hash which is simply a series of letters and numbers you can give it any type of data a word an entire book an image or an audio file also it doesn't matter the length or the size of the data it will always give you a hash of the same length for example the hash of an entire book is the same length as the hash of the single letter C an important point to understand here
- 02:00 - 02:30 is that like what we said any hash you get is not random at all it is like using math to summarize the data you give it so if you input the same data million times into the same hashing function you will always get the same hash it will not change no matter how many times you try another important thing you need to understand is that cryptographic cache functions are one way only so you can never reverse a hash to get the input data if for example we give you this hash there is nothing you can do to get the input data you can only
- 02:30 - 03:00 try to guess by trying many many different inputs and it is still pointless as it is almost impossible for you to guess the input data that generated a specific cache by the way it was hit the like button if you have been enjoying the video hashed with the shot 256 hashing function so returning back to the passwords example like what we said passwords are stored on the server as hashes so that even if the server was attacked the hacker still won't be able to know any real passwords so how do you log in then well when you
- 03:00 - 03:30 are trying to log in any password you try will be put into the hashing function to generate a hash this new hash will be then compared with the hash stored on the server if the hash generated is the same as the hash stored on the server then you will successfully log in but if the generated hash is different then you will get the incorrect password message and you won't be able to access the account now let's get back to the hashing functions so there are many different types of hashing functions or algorithms like the
- 03:30 - 04:00 ND family the shaw family and the ripe MD family the Sean 256 is currently the most commonly used function in crypto as it is still very secure and the sha3 function released in 2015 is the most secure hashing function but it is slower than the Sha 256 and not supported by many applications and Hardware each hashing function you choose to use will give you a different hash with a different length for the same input data for example hashes generated with the md5 hashing function will be composed of
- 04:00 - 04:30 32 letters and numbers so any data you input in md5 no matter its length or size will give you a 32 character hash if you put in a word it will give you 32 letters and numbers and if you put in an entire book it will still give you 32 letters and numbers but on the other hand the shot 256 for example will give you hashes composed of 64 letters and numbers for any data you give it before we get to how these hash functions are used in crypto there are two very important points you need to
- 04:30 - 05:00 understand first you should know that changing anything in the input data will give you an entirely different hash for example if you are hashing a word any slight change like replacing a small letter with a capital letter will give you a totally different hash if your input data is an image even changing tiny pixels will give you an entirely different hash the other important thing you need to understand is that for a hashing function to be secure it has to be Collision resistant which simply means that you can't find two different inputs that will give you the same hash
- 05:00 - 05:30 this is very important as hashing functions are used in digital signatures if there is a hashing function with two different inputs that can give you the same hash then its security is broken and it can be used by attackers to change the documents or files that you digitally sign on for example a scammer may take a check that you digitally signed and edit the check amount and then using some special techniques he can still generate the same hash as the original check which means that your digital signature is valid on the modified check as well
- 05:30 - 06:00 so that is why when collisions are found in a hashing function we stop using it as it is considered insecure and that is what happened with the md5 and the shaw-1 hashing functions a point that may surprise you here is that all cryptographic caching functions have collisions but it should be very very hard almost impossible to find them now let's get to where and how these hashing functions are used in crypto so first of all hashing functions are used to generate your public address on the Bitcoin and ethereum blockchains
- 06:00 - 06:30 you may know that your crypto wallet stores your public key and your private key your public key is a series of letters and numbers that you can share with anyone to send you crypto your private key is also a series of 64 letters and numbers that allow you to spend or use the crypto you have so it should always be kept private from anyone what you may not know here is that the wallet address you see and use on bitcoin or ethereum is not your actual public key but the hashed version of it
- 06:30 - 07:00 in Bitcoin for example your public key is hashed with shot 256 and then the hash we get is hashed again with the ripe md-160 hashing function in ethereum on the other hand your public key is hashed one time with the Keck 256 function and then only the last 40 characters of the hash we get are used as your public key you may be wondering why do we hash the public keys at the first place well public keys are hashed to get a shorter version of them that is easier to give to other users some people think that hashing the
- 07:00 - 07:30 public keys can help improve security if the elliptic curve algorithm was attacked which is the encryption algorithm we used to generate our public and private keys another use of hashing functions is in hashing transactions on the blockchain on bitcoin and ethereum all the transactions are hashed and the hashes we get act like IDs for these transactions so instead of searching for transaction number 1157 in block number 114 562 you can get the transaction details
- 07:30 - 08:00 by simply searching for its hash which is known as transaction ID still this is not the only use for transaction hashes or IDs as they are also used in generating something called a Merkle tree Merkle trees allow us to have a cryptographic proof of the transactions included in each block in their order for example let's say we have a Bitcoin block that has only eight transactions so we will hash the transactions to get their hashes or IDs after that we will take each pair of
- 08:00 - 08:30 sibling transaction hashes and hash them together again to get four new hashes then we will do the same thing with these four hashes to get two new hashes finally we will hash the last two hashes together to get a new hash called the root hash or the Merkle root this Merkel root summarizes all the eight transactions included in the block and it gets included in the header of the block so each block header in Bitcoin includes a Merkle root of all the transactions included in the block which can be up to
- 08:30 - 09:00 2500 transactions or sometimes more any attempts to slightly change or try to reverse previous transactions in a previous block will totally change the Merkel route and it will be different from the one included in in the header which means that the block will be invalid Merkle trees also allow computers on the Bitcoin Network to verify if a specific transaction was included in a previous block or not without downloading all the Block's data the block headers alone are enough which are way smaller in size than the entire Block's data for example
- 09:00 - 09:30 if we want to verify that transaction number four was included in this block we take the hash of the transaction and try to find the path to the Merkle root in this situation we will need the hash of transaction 3 so we can combine it with hash 4 we have to get hash34 we also need hash12 and only the combined hashed 5678 from the other side using these hashes we can get the Merkel root if we get the same Merkel root included in the block header then the transaction was actually included in the
- 09:30 - 10:00 block now we can't talk about hashing functions without talking about proof of work so in proof of work what happens is that computers on the network called miners have to verify transactions and add new blocks to the blockchain for a block to be accepted the miner has to generate a hash that starts with a specific number of zeros for example the network may require the hash to start with five zeros or seven zeros the more zeros at the beginning the more difficult it gets to the miners and this number changes frequently so a
- 10:00 - 10:30 miner will take the block header which includes the Merkel route and other important information about the block add to it a random number called the nonce and then put all of this into the shot 256 hashing function to get a hash if the generated hash doesn't start with the required number of zeros then the miner has to try again this process is known as mining so the miner will change the nuns and try again as many times as it takes to get a correct hash all the miners on the network are
- 10:30 - 11:00 constantly trying to get a correct hash and the first Miner who actually succeeds will get his block added to the blockchain and will be rewarded with new Bitcoins this search for hashes requires spending a lot of money on hardware and energy so it makes trying to add blocks to the blockchain very expensive this mechanism makes it extremely hard for an attacker to add his invalid block to the blockchain as he will need to buy very expensive hardware and run it for years to get his block rejected at the End by the other computers on the network so he will lose all the money he spent
- 11:00 - 11:30 now when a miner adds a new block to the blockchain the correct hash you generated will be added to the header of the next block so all the blocks are connected together in a chain where each block header contains the hash of the previous block so it is not possible to change anything or reverse any transactions in a previous block as slightly changing anything in a previous block will change its hash so it will be different from the hash included in the next block which means that the attacker will need to mine all the following blocks alone which is an impossible thing to do as it
- 11:30 - 12:00 requires enormous computing power that no one can currently Buy in the case of Bitcoin or ethereum at the end of this video we hope you learned what you need to know about the cryptographic hashing functions and how they are used in crypto and if you liked our video and want to reward our hard work hit the like button let us know in the comments if you have any questions or video ideas and subscribe to our Channel and turn on the notifications so you don't miss our new videos thanks for watching
- 12:00 - 12:30 [Music] foreign [Music]