ūüĒī O que √© um hash? (bitcoin / blockchain)


Hello welcome to another video of tribocrypto.com. It is a forum. if you have any questions I recommend you to go there so we keep the whole thing organized I see we’re having enough demand for information about blockchain and here in Brazil apparently most channels cover subjects on how to make money and not about how blockchain works, or how Bitcoin works under the hood. so I have created this forum and this channel to try explain these subjects, to inform you and promote a debate on what is Bitcoin before you venture in this world of cryptocurrencies. Of course, if you like this sort of content.. subscribe to this channel and register on tribocrypto.com and also put your questions there so other people can also answer .. for now the community is growing so I’m seeing that every day more and more people are registering .. then I see that it has enough demand and the subject we’re gonna cover in this video is cryptographic hashes or just “hash”! Hash is a very important subject, mainly because in many places of the blockchain we use hashes. Blockchain is actually a mix of other technologies that already existed and that Satoshi Nakamoto put all in one system only. Satoshi created an ecosystem around gathering all these cryptography concepts and creating a system that we call blockchain. So there’s no way you understand blockchain without understanding each part and the hash is one of the parts you need to understand. In another video I’ve talked about private keys, public, asymmetric symmetrical keys and here I will now talk about hash. As I am putting more computing concepts here, then you will eventually understand how it all works at the same time, because it is impossible for you to understand quickly how the blockchain works in depth. It’s hard to sink in at once. You have to learn one step at a time. From our digital dictionary wikipedia: What is a hash? A hash function is an algorithm that maps variable-length data to fixed-length data. The values returned by a hash function are called hash values, hash codes, checksums or simply hashes. For those who never heard of bitcoin and read this description for the first time here will be scared and will probably say: “I will never this thing” .. because there are many new words. For those who are not engineers all these terms like: checksum, hash, code, algorithm to map the variable length .. They will probably think: “What does this have to do?”. It is very hard to assimilate it all at once .. so I’ll try to summarize what it’s trying to say here. So the hash in fact it is a fixed-length code representing the summary a data of any size. I know it is also not very clear, but during the explanation it may become a little more understandable what a hash is. The hash code or hash is a code that is generated through a step by step that we call “hash function”. Let’s take a look at this small example. Let’s suppose you have a .txt file that you created in Notepad and the contents of this file is exactly this: “Hello, this is a text file written to show how hash functions work” And what will you do? You will pass the contents of that file through a black box that we will call “the hash function” What happens here within this hash function? What is this for? This hash function will make a mathematical calculation There are several kinds of hash functions, but here we will not go into that detail. What exactly happens there? The function will get the file contents and it will perform a step by step until it generates an exit code, which has nothing to do with the original file .. you’ll see .. I’ll show you .. so if we get the file and pass through a hash function .. (in this case I chose a random kind of hash function here) .. it would generate a code This code is what we call a “hash”! And it is the summary! This code you’re seeing here is a summary of this file here! It does not seem to be obviously, because when you hear “summary” is understood that from the summary you would be able to guess what was the original version of that file, but not here. The hash codes are codes that you can not from it generate the original file. It simply serves to something else Now look: this .txt file that I have here, I wrote there: “Hello this is a text file written to show how the hash function works” and see that “Hello” here is accented (Olá in portuguese). Right? What happens if I change “á” by “a”. You think so: if this one is a summary, then the summary will just change a little bit. Right? .. Not really. That is one of the great features offered by hash functions. If you change one little thing, any little thing within this text, even if it’s a subtle thing, this hash will certainly be almost completely different. So here we go: I’ll modify it. I will swap “á” with “a” and let’s see what happens with the resulting hash So keep an eye here that the code generated by the function will be completely different Done! Now you see that.. that small change in the text changed this code completely. The hash function did it’s step by step process with this new file and generated a completely different hash code. All this because I changed “á” with “a”. If I now change this “a” with “á” back again, it will return to the previous hash code. So the hash is deterministic. What does this mean? That means it will always generate the same hash code for the same file, and if I change anything, even if a small thing within the content of this file, the generated hash code is quite different from the previous, as it is here. So any hash function has to have at least these four main properties. The first is that it has to be easy to calculate from any input. That step by step that is there within our hash function .. (Let me go back one slide) .. The step by step that’s is being done here is what we call an “Algorithm”. There is a step by step that is done in each type of hash function to generate a “hash code” or “hash” and it has to be easy to calculate. This input file will go through this so called “algorithm”, and will generate at the end this hash code .. but this step by step must be easy to run. Our second property is that it has to be very difficult for you to generate the same hash for two different inputs. What does this mean? The very same hash should not be easily generated from two different files, as you saw. I just change “á” with “a”, and it created a completely different code Now, is there a way for you to generate two equal hashes for different files? Yes! And it is called “collision” and I will cover this in a little bit, but the main property is that it can not be generated or it is should be very difficult or almost impossible to generate the same hash (the same hash code here) for two different files. Our third property is that it should be very difficult to find out what was original file. So if you do not have access to the file and you only have the hash, you can not generate the original file from the hash This is a very important property which is used within the blockchain too. If it was possible to do this the blockchain would not exist, and that’s all I can tell you right now. But this is is a property that makes it possible to make a blockchain work. Our fourth property is that is has to be very difficult to modify the original entry without changing the generate hash (as we showed here). We modified the original input (changed the “á” with “a”) and the generated hash was quite different. Hash function takes care of that. It makes any simple change generate a hash almost .. or better .. completely different from the previous one. These are the four main properties of any hash function. And what is this hash for after all? Well .. it is used for many different things. Before blockchain existed, what we used hash functions for? In many cases we could use hashes to ensure the integrity of a certain information. So for example: Let’s assume that you have there your file.txt … you pass a hash function and it will generate a hash code. Let’s assume that you will send it to your friend. You will send it over the internet . Your friend will receive this file .. what will he do then? Your friend will send it through the same hash function, which will execute the very same steps and he would hopefully generate the same hash code, or simply hash, and having this information your friend can immediately tell that the file is not corrupt. And that it reflects the exact same file you sent him. This is one of the use cases that you can use hash functions for. Then you can use to ensure the integrity of data. And here comes the question: Is it possible to generate two identical hashes for different data, or could two different files generate exactly the same hash? As I said: Yes! And this is called “collision”. The technical name we give in cryptography. But this is mathematically improbable, not to say that it is practically impossible … of course there is always a small chance. As stated before at the beginning of this presentation, hash functions map variable data to a fixed-length code, so this code is almost always smaller than the original data. So there are chances of two different files to generate the same hash … they go through a function and generate the same code, but it is mathematically unlikely event that you find out what these two files look like to create this collision. And there is only one type of hash function? No! There are several types of hash function, and each has a different mechanism to compute the hash. Some have the hash code size bigger and smaller than others. The mechanism that is used to generate the hash in the hash function can be also different … but the idea of ​​them all is about the same. In the bitcoin .. it is used a hash functions called sha256 of 256 bits length. Right now it’s not important to understand why it is used that one and not another. Here in this example I’ve used a different one. It’s a MD5, which is a type of hash .. but you do not need to know this right now. The MD5 is not used within the blockchain. I just used this in this video for teaching purposes. Now you might think we reached the end of the presentation and you still don’t know what are hash functions for in the blockchain. Well, I’ll give here simply a outline of what it is used for, but then we will get deeper into that in some other video .. but the miners.. when they are mining bitcoin they are trying to earn bitcoins, or in other words, they are trying to keep the consistency of the network and earn bitcoins as the return of their work. They are actually trying to find a hash that meets a certain criteria. This hash will be the winner! The miner that finds that particular hash that meets these specific criteria first will mine that block, and will spread to the network that he found the right hash. As you have seen, you can not find out what will be the hash generated by a given file in advance, so what do they do? They keep modifying this input data dynamically .. randomly to find a hash that meets the pre determined criteria. This criteria is part of the network consensus in the bitcoin network. We will cover this in another video. If you want me keep doing it here, then subscribe to this channel and tell me in the comment section if you liked this video… if you want me to keep making videos in this format .. or if you prefer another format .. Sign up for tribocrypto.com, because that’s where I want the discussions to happen. Over there things happen in an organised way, youtube is very good to present stuff visually, but discussions … it’s better that they keem them in the forum. so the next people arriving in this world of criptomoedas will have organized discussions OK? So let’s build a strong community around cryptocurrency and blockchain, and I see you in the next video. Bye! tribocrypto.com

46 thoughts on “ūüĒī O que √© um hash? (bitcoin / blockchain)”

  1. Muito bom cara, descobri recentemente este mundo de criptomoedas e os seus tópicos no fórum andam me ajudando demais, parabéns!

  2. Excelente vídeo!
    J√° estou vasculhando a internet faz um bom tempo √† procura de informa√ß√Ķes sobre o funcionamento do Blockchain de uma forma compreens√≠vel para n√£o programadores e n√£o encontrava.
    Este canal colma perfeitamente esta lacuna.
    √Č uma pena observar que s√£o poucos os inscritos e poucas visualiza√ß√Ķes tamb√©m.
    Continue assim!
    Vou divulgar teu canal.

  3. Est√° interessado em aprender sobre blockchain, n√©? Ent√£o inscreva-se no canal para ver outras explica√ß√Ķes e conte√ļdos educativos/t√©cnicos e n√£o especulativos sobre criptomoedas: Clique aqui: https://www.youtube.com/tribocrypto?sub_confirmation=1

  4. Muito bom Tiago, explicação didática e de fácil compreensão de um conceito complexo, legal.

  5. Hash ainda é um assunto onde eu preciso avançar, mesmo nos níveis básicos tenho dificuldade, mas vamos persistir.

  6. Beleza eu quero criar meu próprio blockchain esse vídeo e os outros já me ajudou bastante como faço pra me aprofundar, mais no assunto?

  7. √ďtimo conte√ļdo. Uma d√ļvida ali√°s um exemplo " Vamos supor que tenho uma matriz 5×2 que usa c√≥digo HASH e que tenha caracter√≠stica booleana, existe a possibilidade de existir mais de uma HASH para uma matriz igual que tenha as mesma caracter√≠stica para os valores dessa matriz?" N√£o entendo de programa√ß√£o mas tenho essa d√ļvida. Serei grato se tiver esclarecimentos. Obrigado!

  8. parab√©ns Thiago. Vi 3 videos teus de uma vez. Vou reve-los assim que puder e voltarei a falar contigo. √Č apaixonante aprender tudo isso. Vamos em frente. Abra√ßo.

  9. Você explica complicando.
    Se voc√™ se prop√Ķe a dizer exatamente o que √© um hash, voc√™ n√£o pode dizer que n√£o vai entrar neste ou naquele detalhe.
    Você tem que dizer todos os detalhes.
    Caso contr√°rio voc√™ est√° simplificando e n√£o explicando… Ou seja, voc√™ est√° complicando mais.
    Valeu.

  10. cara parab√©ns sua did√°tica √© muito bom gostaria de ver mais conte√ļdo sobre tecnol√≥gica do bitcoin .obrigado

  11. boa tarde, eu queria saber como fazer o download do Hash, pois n√£o estou conseguindo fazer minhas assinaturas digital por causa do Hash que n√£o tem no meu pc, eu sou bem leigo ent√£o desculpa qualquer coisa.

  12. Seu sotaque é lindo! rsrs
    Parabéns, aula excelente!
    Não sou da área, jurava que jamais iria entender o que é hash! rsrs

  13. Sou totalmente leiga meu amigo.
    Entrando agora nesse mundo bitcoin, mais quero aprender com quem sabe de fato.
    Desde já agradeço a sua humildade e mansidão para ensinar com tanta paciência .
    Que o senhor continue lhe dando discernimento.

  14. "Ol√°, este √© um arquivo de texto escrito para mostrar como as fun√ß√Ķes hash funcionam." e9726f6ec4dc6f164358fc9f7f1c861c2b5450536fbcf51836662762036dd3b6
    "Ola, este √© um arquivo de texto escrito para mostrar como as fun√ß√Ķes hash funcionam."
    21ff908bb76e58bf95a98b2864bec842050dba772c5fe2b9a63f9b02d9dc5abf

  15. Estou fascinado pela tecnologia Blockchain, por isso decidi fazer meu Trabalho de Conclus√£o de Curso utilizando essa tecnologia. Bom, sabemos que ela √© um pouco complexa e ainda existe pouco material, se puderem me ajudar eu ficarei muito grato. O meu tema √©, Tecnologia Blockchain como ferramenta de aux√≠lio no meio jur√≠dico, com √™nfase no instituto de provas. Esse tema se direciona a crimes cometidos no cen√°rio virtual. Agrade√ßo a ajuda.ūüí™

Leave a Reply

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