Author

Topic: Blockchain - Understanding it step by step. (Read 428 times)

legendary
Activity: 3472
Merit: 10611
It specify four hashing algorithm which includes SHA-1, SHA-256, SHA-384, and SHA-512.

standard-wise we have 3 SHA algorithms: SHA1, SHA2 and SHA3. the rest are the variations of the same algorithm version with different sizes and slightly different settings. for example SHA384 is the same as SHA512 but when reporting the final result it truncates it to make it 384-bit. same with SHA224 which truncates SHA256. then there is SHA512/256 and SHA512/224.
similarly with SHA3 we have multiple settings, SHA3-224, SHA3-256, SHA3-384 and SHA3-512. and since all of these are keccak we also have Shake128 and Shake256
member
Activity: 174
Merit: 15
We all know Federal information processing standards as a US government security standard that secures our system for theft and also used for cryptographic. It specify four hashing algorithm which includes SHA-1, SHA-256, SHA-384, and SHA-512. SHA is considered to be a successor to MD5, MD5 is currently a standard engineering task force, but is not as fast as MD4 but offers much more of data assurance security.

https://link.springer.com/referenceworkentry/10.1007%2F978-0-387-78414-4_110#Tab1_110 explains better.
hero member
Activity: 2114
Merit: 603
There are a (theoretically) infinite number of inputs you can put in to any hash algorithm, since you can input any string of characters, regardless of length, if you've got a computer that can handle it.

i'm not sure what @so98nn is asking but wanted to add this part:
there is a not-so-obvious limit and that is the limit forced by the method of padding that is used in SHA-2 algorithms. to split the data into blocks it has to be padded, one part of padding is adding the data length to the end.
for SHA-256 (and SHA-224) the data length is added as a 64-bit extra padding and for SHA-512 (and SHA384) as a 128-bit extra padding. that means the data can not be bigger than 264 and 2128 bits, because that padding wouldn't make any sense anymore.
in practice since these numbers are ridiculously big (18 million terabytes) they will never be reached.

usually hash algorithms are all like this such as MD, SHA-1 and RIPEMD160 and they have similar limits. although i think SHA-3 competitors don't have this limit anymore, specifically the winner Keccak doesn't have it. it absorbs "unlimited length" inputs into a "sponge" and spits out "unlimited length" results!


Guys please checkout my post here regarding this discussion. Additionally I have added some more hypothesis that I always wanted to discuss and had many questions regarding them during my learnings.

Thread is here : SHA-256 All Possible Combination & Breaking the code Hypothesis
hero member
Activity: 2114
Merit: 603
snip

snip

May be I will make more sense once I make detailed thread about it. Im just stuck with many things back in office since I work for Vaccine industry. The work is overloaded. Roll Eyes

Worst thing : I have 6 days of working week. Anyways. Willing to read and share soon.
legendary
Activity: 3472
Merit: 10611
There are a (theoretically) infinite number of inputs you can put in to any hash algorithm, since you can input any string of characters, regardless of length, if you've got a computer that can handle it.

i'm not sure what @so98nn is asking but wanted to add this part:
there is a not-so-obvious limit and that is the limit forced by the method of padding that is used in SHA-2 algorithms. to split the data into blocks it has to be padded, one part of padding is adding the data length to the end.
for SHA-256 (and SHA-224) the data length is added as a 64-bit extra padding and for SHA-512 (and SHA384) as a 128-bit extra padding. that means the data can not be bigger than 264 and 2128 bits, because that padding wouldn't make any sense anymore.
in practice since these numbers are ridiculously big (18 million terabytes) they will never be reached.

usually hash algorithms are all like this such as MD, SHA-1 and RIPEMD160 and they have similar limits. although i think SHA-3 competitors don't have this limit anymore, specifically the winner Keccak doesn't have it. it absorbs "unlimited length" inputs into a "sponge" and spits out "unlimited length" results!
legendary
Activity: 2268
Merit: 18771
Are all possible SHA's combination limited ? If Yes, has anyone already counted the number?
I'm not entirely sure what you are asking here? Can you elaborate?

There are a (theoretically) infinite number of inputs you can put in to any hash algorithm, since you can input any string of characters, regardless of length, if you've got a computer that can handle it.
Corrected by pooya87: For SHA256, the number of possible inputs is 264-1, and for SHA512 the number of possible inputs is 2128-1.

There are a limited number of outputs, which depends on the hashing algorithm you are using. SHA256, for example, produces 256 bit outputs, meaning there are 2256 possible outputs.



For anyone else interested in the correction pooya87 explained, see: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf#page=18

Quote
Then append the 64-bit block that is equal to the number L expressed using a binary representation.

For SHA256, as the input must include a 64 bit representation of the length of the original message, the original message is constrained to a length of 264-1.
hero member
Activity: 2114
Merit: 603
~
I am still reading about it and taking out the crunches to publish here. With the discussion you made, I had to go more deeper, and it's not easy.

if you want to go deeper you first have to start by looking around to find where the hash functions are actually used in a cryptocurrency such as bitcoin (or if you are looking at altcoins see what the differences are). off the top of my head there are 6 places where hash functions are used:
1. creating transaction IDs or block hashes
2. proof of work which in bitcoin is the same as block hash
3. merkle tree creation
4. during signing to create the 256-bit integer `e`
5. scripts which mostly use HASH160 (legacy addresses and P2WPKH) but SHA256 (P2WSH addresses) is also used. other hash functions such as SHA1, HASH256 and RIPEMD160 can also be used in scripts
6. creating checksums (used in legacy address creation, P2P network messages,...)

It's a big area to learn. I am already done with point no. 1 and 3 of yours. I will see how it connects with the whole picture.

Its interesting and complex for me at the same time.



Also while studying the SHA's, one question struck on my mind for which I have already worked up some simple math. I would be publishing it as different thread so that we can keep this one focused on different blockchain aspects.

For the heads up :

Are all possible SHA's combination limited ? If Yes, has anyone already counted the number?

In addition to this I worked up one excel to try out all the combinations and got one number.

But before that I need to know whether its limited number or there is no limit?
legendary
Activity: 2268
Merit: 18771
HMAC-SHA512 is also used extensively in hierarchical deterministic wallets. It is used as part of the process to turn your seed phrase (+/- passphrase) in to your root seed, to turn your root seed in to your master private key and master chain code, and to generate child keys from parent keys as you work down the levels of the derivation path in the HD wallet.
legendary
Activity: 3472
Merit: 10611
~
I am still reading about it and taking out the crunches to publish here. With the discussion you made, I had to go more deeper, and it's not easy.

if you want to go deeper you first have to start by looking around to find where the hash functions are actually used in a cryptocurrency such as bitcoin (or if you are looking at altcoins see what the differences are). off the top of my head there are 6 places where hash functions are used:
1. creating transaction IDs or block hashes
2. proof of work which in bitcoin is the same as block hash
3. merkle tree creation
4. during signing to create the 256-bit integer `e`
5. scripts which mostly use HASH160 (legacy addresses and P2WPKH) but SHA256 (P2WSH addresses) is also used. other hash functions such as SHA1, HASH256 and RIPEMD160 can also be used in scripts
6. creating checksums (used in legacy address creation, P2P network messages,...)
hero member
Activity: 2114
Merit: 603
in other cryptocurrencies like litecoin for example is it used scrypt algorithm to solve it's hash in each transaction made that are found in each blocks in the blockchain for bitcoin.

this is wrong. litecoin is a copy of bitcoin with very little number of changes. that means SHA256 (double like bitcoin) is also used everywhere for litecoin including transaction hashes (txid), block hashes (hash of the header that is used in any block header), generation of sighash and in their address generation (RIPEMD160 of SHA256).
the only place where double SHA256 is not used in LTC is for proof of work algorithm. instead it uses scrypt in a failed attempt to make it ASIC resistant.

Let us just wait for my next chapter.

When i will publish it we will make sure we come up with the right thing.  Cheesy

I am still reading about it and taking out the crunches to publish here. With the discussion you made, I had to go more deeper, and it's not easy.
member
Activity: 532
Merit: 36
There is gold in volatility..
From my perspective blockchain , blockchain is a public digital ledger which helps to validate all the transactions taking place in the cryptospace in such a decentralized and transparent manner.

That means:
1. Blockchain helps to prevent double spending.
2. It helps to prevent fraudulent practices.
legendary
Activity: 3472
Merit: 10611
in other cryptocurrencies like litecoin for example is it used scrypt algorithm to solve it's hash in each transaction made that are found in each blocks in the blockchain for bitcoin.

this is wrong. litecoin is a copy of bitcoin with very little number of changes. that means SHA256 (double like bitcoin) is also used everywhere for litecoin including transaction hashes (txid), block hashes (hash of the header that is used in any block header), generation of sighash and in their address generation (RIPEMD160 of SHA256).
the only place where double SHA256 is not used in LTC is for proof of work algorithm. instead it uses scrypt in a failed attempt to make it ASIC resistant.
hero member
Activity: 2114
Merit: 603

OK. Noted. I will be merging both the suggestions above. Since I the targeted audience was more or less new comers I tried to putforth it in simple way.
But surely it's always welcoming add more to the knowledge base.

I will come up with little different way to link all the suggestions and also keep up the above article as it is.


1. Understanding How Hash is created?
~
Quote from: Maus0728
~

Thanks for the heads up mate. I will surely refer this one.
What I said above does apply here for target audience, so i have written simplest form of the solution for this too. But will connect it logically with this article too.
legendary
Activity: 1904
Merit: 1563
1. Understanding How Hash is created?

As for your next update, you can also view the thread that I have created recently that pertains to a similar topic.
Blockchain Basic: Number System | Random Number | Hash Function
I hope that it will somehow help you in your research especially on hashes. I would love to hear another lesson from you.

@o_e_l_e_o is correct. It would be nice if you are going to edit the correction made by @pooya87. Furthermore, it is also important to keep in mind the basic number system specifically the difference between these 3 classifications used by machines and humans.

Quote from: Maus0728
Topic 1: Number System

  • Decimal (base 10) – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  • Binary (base 2) – 0, 1
  • Hexadecimal (base 16) – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. | A = 10; B = 11; C = 12; D = 13; E = 14; F = 15

BINARY NUMBERS

  • A Binary Number is made up of only 0's and 1's. There is no 2, 3, 4, 5, 6, 7, 8 or 9 etc
  • A single binary digit (like "0" or "1") is called a "bit" (binary digit)
  • For example 1101010 is 7 bits long.
  • A binary number of 8 bits is called a byte. (1 byte = 8 bits)
  • Two bytes has 16 bits, three bytes has 24 bits
  • Binary numbers are used mainly in computers.
  • Binary system is also called base – 2 numeral system. Because it only consists of 0 and 1.

DECIMAL NUMBERS

  • Decimal number only consists of 10 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
  • Based on wiki, “decimal” comes from the latin word “decimus” which means 10.
  • Mainly used by humans.
  • Decimal System is also called Base – 10 numeral system. Because it only consists of 10 digits from 0 - 9

HEXADECIMALS NUMBERS

  • Hexadecimal numbers consists of 16 sysmbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F
  • Mainly used by humans and computers.
  • The latin word hexa means 6 while the decimus which is the latin word for decimal means 10 thus when combined meaning 16.
  • Examples: 1D8A, 8B2F
  • Hexadecimals number are commonly prefixed by “0x” to avoid being mistaken to be a decimal number. Example: 0x1D8A, 0X8B2f, 0x9486.
  • Hexadceimal is also called Base – 16 numeral system
full member
Activity: 924
Merit: 221
SHA means Secure Hash Algorithms that used in cryptocurrency technology. SHA-256 is used in bitcoin while in other cryptocurrencies like litecoin for example is it used scrypt algorithm to solve it's hash in each transaction made that are found in each blocks in the blockchain for bitcoin.
legendary
Activity: 2268
Merit: 18771
For example, a SHA-256 will have 64 characters. It will have A-Z or 0-9 characters in its every space from 1st to 64th characters.
To add on to what pooya87 has said, this isn't correct either.

64 characters is the wrong way to look at it, since the number of characters is entirely variable depending on what base you are encoding it in. The better way to look at it is that SHA-256 outputs 256 bits, represented by a 256 character number composed entirely of zeros and ones. If you encode that in hexadecimal, then you will get 64 characters. The characters are not A-Z and 0-9, however. They are A-F and 0-9. Each character of this hexadecimal number represents 4 bits of data.

This table might make it more clear:


hero member
Activity: 2114
Merit: 603
Chapter-I: BLOCKCHAIN - a step by step guide.

Blockchain Technology: - Most commonly it is defined as a decentralized, distributed ledger that records the source of digital assets.
"blockchain technology" usually refers to the cryptocurrency technology. otherwise if (like your title) you want to describe "blockchain" it is simply a "chain of blocks" as the name suggests. it has nothing to do with being decentralized or distributed and there is no "digital asset" involved in it.

Quote
First of all, in easy words it’s an alpha-numeric code.
a very bad definition because you are describing the representation not what the hash does.

Quote
Notice that I have just changed the “n” alphabet in the second sentence and thus it has given a completely different hash
you may want to mention that this characteristic is called: https://en.wikipedia.org/wiki/Avalanche_effect

Quote
Most important are SHA-2 and SHA-3. In this, you might notice that there is a number followed by the name SHA, those are the nominators of size of the hash.
the numbers after the term "SHA" is the version of the algorithm. SHA-1 being version 1 of the algorithm and SHA-2 and SHA-3 the version 2 and 3 respectively. the other number that is put after that indicates the size. for example SHA3-256 is the version 3 secure hash algorithm (keccak) that returns a fixed length result of 256-bit.

Quote
**Suggest the right board if this one is not correct
beginners and help.

Amazing.

Each time I read it there are new things pop up.
Thanks for the heads up. I will keep reading and evolving the articles. At the end I am planning to make everything into sharable PDF file.
I will note down your suggestions.




Quote
the numbers after the term "SHA" is the version of the algorithm. SHA-1 being version 1 of the algorithm and SHA-2 and SHA-3 the version 2 and 3 respectively. the other number that is put after that indicates the size. for example SHA3-256 is the version 3 secure hash algorithm (keccak) that returns a fixed length result of 256-bit.



That is far descriptive. I will update it too.

These articles and discussion like this will eventually help newbies. I hope so!  Smiley
legendary
Activity: 3472
Merit: 10611
Chapter-I: BLOCKCHAIN - a step by step guide.

Blockchain Technology: - Most commonly it is defined as a decentralized, distributed ledger that records the source of digital assets.
"blockchain technology" usually refers to the cryptocurrency technology. otherwise if (like your title) you want to describe "blockchain" it is simply a "chain of blocks" as the name suggests. it has nothing to do with being decentralized or distributed and there is no "digital asset" involved in it.

Quote
First of all, in easy words it’s an alpha-numeric code.
a very bad definition because you are describing the representation not what the hash does.

Quote
Notice that I have just changed the “n” alphabet in the second sentence and thus it has given a completely different hash
you may want to mention that this characteristic is called: https://en.wikipedia.org/wiki/Avalanche_effect

Quote
Most important are SHA-2 and SHA-3. In this, you might notice that there is a number followed by the name SHA, those are the nominators of size of the hash.
the numbers after the term "SHA" is the version of the algorithm. SHA-1 being version 1 of the algorithm and SHA-2 and SHA-3 the version 2 and 3 respectively. the other number that is put after that indicates the size. for example SHA3-256 is the version 3 secure hash algorithm (keccak) that returns a fixed length result of 256-bit.

Quote
**Suggest the right board if this one is not correct
beginners and help.
hero member
Activity: 2114
Merit: 603
Updates:

Up-next in the chapter :

1. Understanding How Hash is created?
2. What are the Nonce, Nodes, Client & relations between them.
3. Merkle trees & their formation.
hero member
Activity: 2114
Merit: 603
Hello Folks!
I have started going through blockchain technology and its core working. Since I am in the learning phase, I would like to publish my readings inhere which would be useful for the fellow readers!

Chapter-I: BLOCKCHAIN - a step by step guide.


Blockchain Technology: - Most commonly it is defined as a decentralized, distributed ledger that records the source of digital assets.
Now this definition is very common but could be complex for new people to understand in one go.
So here is lighter version of the same:

Let us break down the Block-Chain word and understand it.

Block: It basically contains the digital information that originated from the digital source with some input.




Chain: On border scope this is the place where data is stored, a public ledger! i.e. Public database.  The chain formed by addition of above blocks one after another. An imaginary chain of blocks would look like something as shown in the below image.






Until now we went through the Blockchain in a border sense. However in the process we have come across different terminology that indeed need to be understood for core learnings. For example, Hash, Genesis block, Digital Signature. Also some of the terms that we will learn furthermore would include Nonce, Nodes, Hash Functions (different types of SHA’s), Merkle Tree & Root etc.


What is Hash?

First of all, in easy words it’s an alpha-numeric code. It is of fixed length based on the type of hash function. For example, a SHA-256 will have 64 characters. It will have A-Z or 0-9 characters in its every space from 1st to 64th characters.

Thus, it is a process of generating fixed size output from an input of variable size. This is achieved through a mathematical expression known as Hash Formula. For input validation output has to be the same length all the time to have resistance. Moreover, a useful hash always gives output with different characters.

For example: SHA-256 for so98nn is BitcoinTalk user is as follows:

Code:
814a31e327932a759de8ceae6861544401af2cbdf70310cc3898a45fcedba98e

In the above example, sentence “so98nn is BitcoinTalk user” is an Input given while the later is Hash code generated from it. This is unique code and there is a way to generate different code for the same sentence above. However, if you change any single character of the sentence then the whole Hashcode will be different.

For example: SHA-256 for so98nn in BitcoinTalk user is as follows:

Code:
b87b6e2099b132fe873aeec15c34cb2ee4e51da3ed7adf65ca46e513a285c577

Notice that I have just changed the “n” alphabet in the second sentence and thus it has given a completely different hash as compared to the original one. This is why it becomes more unique and integrity of data is maintained with such a complex code generation system.

Create your own Or verify above Hash here :
Code:
https://emn178.github.io/online-tools/sha256.html


Most important are SHA-2 and SHA-3. In this, you might notice that there is a number followed by the name SHA, those are the nominators of size of the hash. That means, if I say it's SHA-256 then, 256 is bite size for that hash. Thus, it can’t have more size Or lesser than that.

There could be different types of hash functions as follows:

1) Secure Hashing Algorithm (SHA)
2) RACE Integrity Primitives Evaluation Message Digest (RIPEMD)
3) Message Digest Algorithm-5 (MD-5)
4) BLAKE2

Since the most common hash function that we are using in the world of bitcoin is SHA-2, we should know that there are sub-types such as SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224, and SHA-512/256.



* I will continue the rest of the learnings afterwards . . .
**Suggest the right board if this one is not correct




Jump to: