Title: Blockchain Basic: Number System | Random Number | Hash Function Post by: Maus0728 on April 13, 2020, 08:51:08 AM Good Day Everyone, I hope you are having a fantastic day today.
I am a freshman Computer Engineering student in the Philippines and I decided to create a thread wherein I will use bitcointalk as a means of sharing my knowledge that I absorbed during my stay in the University and from the knowledge I consume when I am doing a self – study about the technicalities of bitcoin and its network. I am not a native English speaker but I will try to explain the technical terms and the concept clearly and concise as much as possible, so please bear with me. I am posting a sequential lesson in this thread and I'll try to edit or reply in my own thread whenever I learned something that I think is very beneficial for newbies to know and to avoid multiple creation of threads. This way I can just simply add and link them to an overview section below. Why I am creating this thread:
TOPIC OVERVIEW Topic 1: Number System (#post_nsystem) Topic 2: Understanding the concept of Random Number (#post_rannum) Topic 3: Hash Function (#post_hfunction) Topic 1: Number System
BINARY NUMBERS
DECIMAL NUMBERS
HEXADECIMALS NUMBERS
CONVERSION FROM BINARY TO DECIMAL AND HEXADECIMAL NUMBER CONVERSION FROM DECIMAL TO BINARY AND HEXADECIMAL NUMBER Conversion steps from decimal to binary 1. Divide the number by 2. 2. Get the integer quotient for the next iteration. 3. Get the remainder for the binary digit. 4. Repeat the steps until the quotient is equal to 0. Conversion steps from decimal to hex: 1. Divide the number by 16. 2. Get the integer quotient for the next iteration. 3. Get the remainder for the hex digit. 4. Repeat the steps until the quotient is equal to 0. IMPORTANT NOTE: I used pen and paper to at least give an example on how I manually convert these problems. It is a very tedious work if I will use graphic editing tools to represent the computation. CONVERSION HEXADECIMAL TO BINARY AND DECIMAL NUMBERS https://i.imgur.com/IAF7MnW.png https://i.imgur.com/vVzpiZQl.png (https://introcs.cs.princeton.edu/java/61data/images/hex-to-binary.png) https://i.imgur.com/RkVlBmll.jpg (https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fcircuitglobe.com%2Fwp-content%2Fuploads%2F2016%2F09%2Fhexadecimal-to-binary-conversion-examples-3.jpg&f=1&nofb=1) References and resources: https://www.rapidtables.com/ https://www.mobilefish.com/home/welcome/welcome.html Topic 2: Understanding the concept of Random Number return to index (#post_index) Note that the next lesson is just an introduction of the importance and concept of random number in blockchain technology. Random number is a very complex lesson for a beginner to understand so I am trying my best to explain it clearly. You can use the title of the lesson to further research on the said topic. What is Random Number
Why random number is significant in blockchain technology?
Upon doing my research, it is somehow connected to the bitcoin’s cryptographic algorithm Elliptic Curve Digital Signature Algorithm (ECDSA). I won’t explain this algorithm much further since I am still lack of knowledge to understand this kind of cryptography. This algorithm is google – able, so you can find a lot of the information on the internet. The most common example for this type of generating a random number is called Mid – Square Hashing or Middle Square Algorithm wherein it basically explains how a random number can produce a much larger numbers that can be used of hashing. However this is just an example and this type of hashing algorithm is not used in blockchain technology. Here are the two examples that I found on the internet. Code: Suppose a 4-digit seed is taken. seed = 3685 Code: Suppose a 4-digit seed is taken. seed = 3685 References and resources: https://www.geeksforgeeks.org/mid-square-hashing/ https://thirtyk.com/2018/07/18/blockchain-random-numbers/ https://www.mobilefish.com/home/welcome/welcome.html Topic 3: Hash Function return to index (#post_index) What is Hash Function? - A function that takes input value, and from that input creates an output value based from the input value. It can convert a string or a data of any size and outputs a hash. A hash is usually displayed as a hexadecimal number. A small change in a string of text or data will output different hash There is also some instances that two different data can produce the same hash. This is called “Hash Collision”.. However, According to Stack Exchange, the hash function can also be considered as “Hash Collision resistant ” when there is a difficulty in finding 2 data or input that has the same hash output * - not collision resistant References and sources: https://www.pelock.com/products/hash-calculator https://en.wikipedia.org/wiki/List_of_hash_functions#Cryptographic_hash_functions https://crypto.stackexchange.com/questions/8509/why-crypto-hash-functions-must-be-collision-resistant-and-how-to-find-resistant Title: Re: Blockchain Basic: Number System | Random Number | Hash Function Post by: KuysNARD on April 13, 2020, 10:38:31 AM Very useful tips sir , i been strugling reading convertions from my old school before its all thumbs up :)
Title: Re: Blockchain Basic: Number System | Random Number | Hash Function Post by: Velkro on April 13, 2020, 03:46:56 PM Very well made, i mean its going to the basics but basics of basics, that many people overlooks as not needed and they skip ahead.
Lots of work done, nicely shown, keep it up. You will benefit this community and learn yourself a lot this way. Again, good job! :) Title: Re: Blockchain Basic: Number System | Random Number | Hash Function Post by: khaled0111 on April 13, 2020, 10:59:04 PM I would like to thank you for the detailed and in-depth explanation.
I have some suggestions if you don't mind: - explain what a one way function is. - give examples of different hash functions and how secure they are. - replace the md5 example with a more secure function like sha256. It may be confusing as md5 is not used by the blockchain technology. Can't wait to read your topic about encryption :) Title: Re: Blockchain Basic: Number System | Random Number | Hash Function Post by: iCrypto2 on April 14, 2020, 04:47:01 AM Very interesting information that could be useful for everyone who'd take the opportunity to read and understand everything you've posted so far. I'm also awaiting updates to this thread as you add and provide additional info or requests from community members here. Kudos!
Title: Re: Blockchain Basic: Number System | Random Number | Hash Function Post by: pooya87 on April 14, 2020, 06:35:13 AM Quote A binary number of 8 bits is called a byte. (1 byte = 8 bits) technically it is called an "octet" and an array of them is called an "octet string". apparently there is a programming language or two that have a different definition for a "byte". if you look at most documentations (eg. the RFC docs, NIST standards,...) they all use the term "octet".but since the popular programming languages have a variable type called byte that is the same as an octet we commonly use the term byte to describe 8-bits. Quote Upon doing my research, it is somehow connected to the bitcoin’s cryptographic algorithm Elliptic Curve Digital Signature Algorithm (ECDSA). in practice we don't generate any random numbers using any RNG in ECDSA. instead we use a deterministic random number which is a number derived from combining 2 random sources: the private key + message hash being signed.in fact when you only use RNG once per wallet nowadays (to create a seed for your deterministic wallet) then everything else from creating new keys to signing transactions is deterministic. Title: Re: Blockchain Basic: Number System | Random Number | Hash Function Post by: Maus0728 on April 17, 2020, 04:03:44 AM Very useful tips sir , i been strugling reading convertions from my old school before its all thumbs up :) Thank you so much, actually there are lots of in-depth explanation regarding these topics on the internet. This is just a guide on how you can easily understand the basic of blockchain. Very well made, i mean its going to the basics but basics of basics, that many people overlooks as not needed and they skip ahead. Lots of work done, nicely shown, keep it up. You will benefit this community and learn yourself a lot this way. Again, good job! :) Thank you so much @Velkro, you know it gives me a boost to continue what I am doing right now. Thank you for the kind words and inspiration, much appreciated. I would like to thank you for the detailed and in-depth explanation. I have some suggestions if you don't mind: - explain what a one way function is. - give examples of different hash functions and how secure they are. - replace the md5 example with a more secure function like sha256. It may be confusing as md5 is not used by the blockchain technology. Can't wait to read your topic about encryption :) Hello @khaled0111, also thank you for those words of affirmation. Very much appreciated. I'll try to study those lesson first to avoid giving false information, this technology is very vast and it is not easy to understand in just one night but I'll try my best to self learn these complex topics and share these to the public. technically it is called an "octet" and an array of them is called an "octet string". apparently there is a programming language or two that have a different definition for a "byte". if you look at most documentations (eg. the RFC docs, NIST standards,...) they all use the term "octet". but since the popular programming languages have a variable type called byte that is the same as an octet we commonly use the term byte to describe 8-bits. As a newbie and a starter in learning blockchain, this may seem a little technical and quite hard to understand if one is lacking programming skills and other related computer science background. During our last discussion recently, this was the clearest explanation I've ever had about the definition of byte which is 8 bits and till' now I still believe that this is the right term. I've done a little research in Stack overflow and as I have understood, the octet is always 8 bits which is obviously from octo means 8 while the byte size differs according to its hardware, which means byte is sometimes has a size of 8 bit or in some cases 16 bits. I need a lot of understanding to these basic terminologies I think and is very overwhelming. Thank you very much @pooya87 in practice we don't generate any random numbers using any RNG in ECDSA. instead we use a deterministic random number which is a number derived from combining 2 random sources: the private key + message hash being signed. in fact when you only use RNG once per wallet nowadays (to create a seed for your deterministic wallet) then everything else from creating new keys to signing transactions is deterministic. Honestly, this is way beyond my understanding but I'll try my best to understand every concept from scratch up to the very complex part of these algorithms. Its pleasure that you noticed my thread @pooya87. Thank you. Title: Re: Blockchain Basic: Number System | Random Number | Hash Function Post by: pooya87 on April 17, 2020, 04:35:09 AM As a newbie and a starter in learning blockchain, this may seem a little technical and quite hard to understand if one is lacking programming skills and other related computer science background. During our last discussion recently, this was the clearest explanation I've ever had about the definition of byte which is 8 bits and till' now I still believe that this is the right term. "byte" is indeed the right term, don't worry too much about it. i'm just adding a little bit of additional information that could be useful to have in mind in case you encounter the term somewhere. it caused me some confusion the first time i saw the term "octet string" as i thought it is something different than a "byte array". Title: Re: Blockchain Basic: Number System | Random Number | Hash Function Post by: Maus0728 on April 17, 2020, 05:01:14 AM "byte" is indeed the right term, don't worry too much about it. i'm just adding a little bit of additional information that could be useful to have in mind in case you encounter the term somewhere. it caused me some confusion the first time i saw the term "octet string" as i thought it is something different than a "byte array". Do you think that this thread will help understand the basic and most neglected part of the blockchain? I am trying my best to understand and find some resources to study blockchain in a step by step process. Am I on the right path? I've decided to study blockchain because it is somehow connected to my course. I also want to be one of the members here who has a very deep understanding in the philosophical and technical aspect of bitcoin and its network. Thanks for inspiring! Title: Re: Blockchain Basic: Number System | Random Number | Hash Function Post by: Chikito on April 17, 2020, 05:56:35 AM So we can make private key bitcoin [Hexadecimal] using random binary number [256 bits], then using bitaddress.org tool for converting Hex privkey into Private Key WIF Compressed, also we can see public key Bitcoin.
Binary to Hexadecimal has an exact formula, we can converting using excel (spreadsheet) and windows calculator. Windows calculator only has 64 bits, so we have 4 steps to do 256 bits. I have already made a tutorial how to converting Binary into Hexadecimal. [1]. How to Flip Binary into Hex Private Key Using Excell or Spreadsheet (https://bitcointalk.org/index.php?topic=5207010.0) [2]. Converting Binary into Hexadecimal using calculator (https://bitcointalk.org/index.php?topic=5205729.msg53332763#msg53332763) Title: Re: Blockchain Basic: Number System | Random Number | Hash Function Post by: Wenbing on April 17, 2020, 07:03:00 AM Detailed computer mathematical breakdown.
Since you've explain concepts like, binary, hexadecimal , decimal, bit and byte, I'll suggest you explain related mathematical concepts such as: 1. Integer 2. Strings 3. Functions 4. Megabyte, gigabyte, terabytes 3. The hash function. This will help many. Thanks for your effort. Title: Re: Blockchain Basic: Number System | Random Number | Hash Function Post by: pooya87 on April 17, 2020, 09:18:28 AM "byte" is indeed the right term, don't worry too much about it. i'm just adding a little bit of additional information that could be useful to have in mind in case you encounter the term somewhere. it caused me some confusion the first time i saw the term "octet string" as i thought it is something different than a "byte array". Do you think that this thread will help understand the basic and most neglected part of the blockchain? I am trying my best to understand and find some resources to study blockchain in a step by step process. Am I on the right path? I've decided to study blockchain because it is somehow connected to my course. I also want to be one of the members here who has a very deep understanding in the philosophical and technical aspect of bitcoin and its network. Thanks for inspiring! when you say blockchain it is referring to such a broad range of topics with cryptography being the dominating topic. so with the topics you listed here you seem to be in the right path mainly Hash functions and Asymmetric Cryptography topics. these could cover the basics then you can move on to how bitcoin is using all that in its Proof of Work algorithm (for mining), in its creation of the chain, and how it uses ECDSA in creating signatures and security that comes with that. and finally a more advanced topic could be the bitcoin script language. |