Welcome everyone! My name is Ramakanth. Welcome Back to Crypto Kalsala
In the last video, we learnt what is Bitcoin
and when compared to Fiat Currencies
why it is much better. Just in case
if you didn't watch that video, please watch it.
I shared the link in the below description.
Before entering into our topic today, as usual small disclaimer.
Whatever I am explaining in these videos is not a financial advice.
These are all my own views
coming out of my limited knowledge whatever I have. So,
based on these videos, do not take any investment decisions.
I am not responsible for your profits and losses.
Ok
Today's topic could turn out to be a bit technical
and tough to understand.
But, these basics
will help you a lot in understanding how bitcoin works.
So, let's jump into it.
Today's topic is: What is Cryptography and how it is used in Bitcoin.
The word "Cryptography" came from two Greek words
"Crypto" means
"Hidden Secret"
and "Graphy" means "To Write" or "To Study"
So Cryptography means
Study of a subject that deals with sending secret messages from one person to another
without anyone in the middle being able to tap it
or able to read it.
Cryptography as a subject is so powerful
that till 1990 almost
in all countries, it was illegal to export it.
That means,
any kind of formulas that are used in this subject,
or any other information related to it
were not known to the normal public.
Most of the times, only Military or Intelligence agencies
used to study this subject.
And the algorithms (or formulas) used in Cryptography
were kept very confidential by every country.
So, in Cryptography
two words are heard pretty frequently.
Those are....
Encryption and Decryption.
Encryption means converting a normal text or message,
using some or the other formula,
in to an unreadable format.
For example,
look at this message.
It says: "Attack Terrorists Tomorrow".
If a military officer has to send this message
to another military officer, just
sending this normal message can be dangerous right?
Someone in the middle can easily read it
But instead of that,
if that message is written using a simple
formula, then
for example, like this if every letter
is replaced by the 3rd letter that comes after it,
that means
"A" can be moved 3 letters forward like B, C, "D".
Like that
if we move "T" three letters, we get "W".
So, like this if all letters
are moved 3 places and replaced,
then the original sentence will change in to such a meaningless sentence.
Like this, converting an understandable message in to an unintelligible message is called "Encryption".
The Encryption that we just used is known as "Caesar's Cypher".
Because, this method of Encryption was used by a Roman emperor called Julius Caesar
to send instructions to his military commanders.
Ok. So, now what to do to convert that unintelligible message
in to a normal message?
Simple.
Using same number we need to reverse it.
That means...
If we count 3 letters backwards from "D", we get "A", and similarly,
if we move all the other letters, 3 places backwards, we will get our original sentence.
Like this, converting an unintelligible sentence
or an encrypted message
in to an understandable form is called "Decryption".
So, converting a message from a human readable format in to non-sense
or unreadable format is called Encryption.
Again converting from that unreadable format in to a readable format is called Decryption.
And, the secret number that we used while using the formula,
here we used the number 3 right,
that number is called "KEY".
The formula that we used,
i.e. we replaced every letter with some other letter right,
that kind of a formula is called "Cypher".
So, a text converted using a Cypher is called "Cypher Text".
To avoid any confusion for you, I summarized it here in a simple manner. Please look at the screen.
Ok, So now,
whatever the encryption that we just used
can be broken pretty easily. It is because,
in English language,
there are only 26 letters right, so,
as we are using only one KEY to replace all the letters,
maximum we need to try only 26 combinations.
we can decrypt it very easily.
But, if we need to make it harder to break this encryption, then
instead of replacing all the letters with one number
if we replace using different numbers, then
for example,
like this, "A" replaced with a letter after 5 letters,
"t" replaced with a letter after 6 letters,
like this if we use a 10 digit encryption
then, do you know how many combinations need to be tried to decrypt this encryption?
1 Billion combinations. Haha
For normal human beings, using a 10 digit encryption is more than enough.
But
the computers that we have today can solve those billion combinations
easily within a few minutes.
That is why, these days for Encryption
we use 256 bit Encryption. Which means,
approximately 64 character length.
That means, even if all the computers in the world
try to break this encryption,
to try out all the combinations, it will take trillions and trillions of years.
So, we can consider it as almost impossible to crack.
So, like this if same key is used to encrypt
and decrypt then,
it is called as "Symmetric Encryption".
There is a problem with this Symmetric Encryption.
That is, if two people are near each other
they can share this secret key pretty easily.
But, if they are far away from each other in different countries, then
how will they be able to share that secret key?
if they share it through internet or phone, then
someone in the middle can tap the phone or
if it is on the internet someone can hack and get hold of that secret key.
This is called "Man in the middle attack".
So using Symmetric Encryption when sender
and receiver are far away from each other is risky.
That is why these Cryptographers
did lot of experiments and found something called
Asymmetric Encryption.
This is also called "Public Key Cryptography
In Symmetric Encryption,
same (one) key is used for encryption and decryption right,
But
in Asymmetric Encryption
one key is used for Encrypting and another key is used for Decrypting.
In these two keys, one is called as "Public Key" and the other one is called as "Private Key".
"Public Key" means
as it contains in its name,
you can share it publicly.
You can give it to as many people as you want.
For example, consider it as your "Email ID".
Whenever someone need to send an email to you,
you give them your email ID right. In the same way,
if someone wants to send you a secret message or transaction,
you can share this public key with them.
Next, "Private Key".
This is also as it contains in it's name,
it is a key that needs to be stored Privately or in secret.
Other than you, no one should know this key.
For example, like your "Email Account Password".
You give your email ID to your friends and neighbors, but
you don't give your email password right.
In the same way here, you can share your public key but
you shouldn't share your private key.
So, in this Asymmetric Encryption method
if two people want to send a secret message between themselves,
then they share their public keys with each other,
encrypt the message with the opposite person's public key and send the message.
So that
the opposite person can decrypt using his/her private key
and can read that message.
No one else can read that message.
So, public key is used to encrypt a message
and private key is used to decrypt a message.
If you want to remember it in a simple manner,
consider public key as your email ID and private key as your password.
Ok? Right.
Now, this private key has some other use also.
That is...
Digital Signature. Which means,
whenever you are sending a message,
how do people on the receiving end are sure that the message is coming from you?
For example, if you have a cheque
to deposit in a bank
and you sent your employee to do that,
then how will the banker know that you are the person who sent that cheque?
Because that cheque will have your signature.
In the same way, if you want to send a secret message or transaction online then
to prove that the message is coming from you,
you digitally sign that message with your private key.
Digitally signing doesn't mean you have to do anything complex.
Software on your computer takes care of all that complex details.
You would just click a button to give permission, that's it.
So, just remember that "Private Key" is used for digital signatures.
Ok. We learnt that these days for Public and Private Keys
we are using 256 bit encryption.
But sharing that 256 bit public key is tough right?
That key is somewhat lengthy.
So, how to shorten that key?
For that, the technique used by Cryptographers is called "Hashing".
There is a small difference between Encryption and Hashing.
Encryption is called as a "TWO Way Function"
Because,
if we have both Public and Private key,
a message can be encrypted and it can also be decrypted.
But,
Hashing is a ONE way function
which means, there won't be any concept of "keys" here.
After hashing a text/message once, whatever the result you have got
cannot be decrypted back to the original message. It is mathematically impossible.
Hashing means...
converting a text/message (of whatever length) in to a fixed length message.
Which means, for example, if you have to send a 10 page secret text
to your friend, then
the whole text, using hashing technique,
can be converted in to an alpha-numeric code of just 64 character length.
There are a few types of hashing techniques but
as of now we need to know just one type of hashing technique. That is...
SHA256
SHA stands for "Secure Hash Algorithm"
Using this algorithm,
a fixed length 256bit code is generated. That is the reason why they call it SHA256.
256 bits can be considered to be equal to 32 byte length or 64 character length.
If I have to explain how SHA256 or Hashing algorithm works in detail it would take me a long time,
so, I will simplify it for you.
Your 10 pages of secret text
is split into smaller parts, and
one part is
used with this hashing formula
to generate a 256bit length or 64 character length code.
Again that 64 character length code is added to second part
and hashed again.
In this way, if the entire text is hashed till the last part then at the end, only 64 character length code will be left.
So, how much ever lengthy the message could be, even thousands of pages,
it can be converted in to a 64 character length code.
So, there is one more great thing about this hashing technique. That is,
in your text, even if a single letter is changed,
even a full stop or a comma is changed,
that 64 character length code will change completely.
And no one can guess how it will change and what the final result could be.
For example, look here.
In this SHA256 generator, I am typing a sentence.
"Hello I am Ramakanth"
Look at the hash that got generated at the bottom of the screen.
Now, if I add even a full stop,
that hash will change completely. Have a look!
Did you see how it changed?
In the same way, even if there is a small difference (such as extra "space") also it will change.
But
the thing that you need to notice is that,
even that changed code will also be of same length (which is 64 character length)
Now I will write a letter. For example: "B"
Still
observe that hash at the bottom of the screen is of same length.
Even if I copy and paste 2 pages of text,
still resultant hash will be of same length.
Ok? Right!
That means, behind every 64 character length code generated by using this SHA256 hashing,
only 1 message will be there.
Generating the same code using some other message is almost impossible.
That means, every hash has a unique message behind it.
So, now you might be understanding how difficult is the puzzle that I gave you guys in the last video :)!
Other than using different sentences
and comparing the code that you got
with the code that I gave you, you don't have any other option.
That means, unless you know the sentence, breaking that code is impossible.
So, let's see what is the sentence behind the puzzle.
That is, as I gave it in the clue,
it is a commonly used sentence/phrase in Crypto community
That is..
"Short Bankers Long Bitcoin".
Look here. If you enter that exact sentence, you will get the exact code that I gave you guys.
I know it is hard!
Do you think I will give my Satoshis so easily? haha
Ok. Now you know about Symmetric and Asymmetric Encryption,
Digital Signatures and Hashing.
But, if you want to know how they are used in Bitcoin Network
in a detailed manner, you will know it in the upcoming videos. But,
here in this video I will explain very briefly.
The way in which you send your email from one Email ID to another email ID,
In the same way, you can send Bitcoin from one Bitcoin address to another Bitcoin address.
Look here. This is how a Bitcoin address looks like..
This address is nothing but your "Public Key"
But, because public key tends to be a bit longer
they hash it and convert it in to a 34 character length alpha-numeric code.
There is a 8-9 step process for generating Bitcoin address.
And in that process
they use multiple hashing functions.
Not just SHA256 but RIPEMD160 and Base 58 encoding are also used.
That is why Bitcoin address size is less than that of a SHA256 hash.
But, it is almost always between 26-35 characters long.
So hashing is used to generate Bitcoin address,
to convert transaction data in to transaction ID,
Plus, used in Bitcoin mining also.
And, before sending Bitcoin from one address to another address,
the person who is sending the transaction, i.e. Sender
signs the transaction with his private key
and mentions the address of the person who is receiving the Bitcoin.
So that the signature on that transaction
is verified by the miners.
And the person who is receiving those bitcoins
decrypts it with his private key
and uses it.
So, this is how Digital Signatures and
Asymmetric Encryption are used to send and receive bitcoins,
and for miners to verify transactions.
In Bitcoin network, to generate these digital signatures and public and private keys,
an algorithm called ECDSA is used.
ECDSA means "Elliptic Curve Digital Signature Algorithm"
You don't have to learn anything about it as of now.
I told you just for your information.
Anyway, whatever I told you till now,
can be remembered by you in just these 3 sentences.
If same key is used for Encryption and Decryption then it is called Symmetric Encryption.
If Public Key is used for Encryption and Private Key is used for Decryption then it is called Asymmetric Encryption
If a text of any length is converted into a fixed length alpha-numeric code, then it is called Hashing.
Ok? Looking at all these terms, don't think that using Bitcoin is pretty difficult.
Even if you don't understand any of these, it is fine
Your Bitcoin wallet software will take care of all these details.
But, if you understand these things, then while using Bitcoin
you will be able to understand easily what is private key,
and why you should keep it safely,
why Bitcoin address is so meaningless and weird, etc.
And also many other things will be easy to understand if you understand these basics.
Anyway, now you understood about Cryptography,
Encryption and Decryption and Hashing.
But lot of people who talk about Bitcoin also use another word...
"Blockchain". You would have heard about it.
So, what is Blockchain?
What is the relation between Blockchain and Bitcoin?
Is there any difference between Blockchain and normal database?
When we do online banking
the digital money we see in our account
is maintained by Bankers.
But who maintains this Bitcoin database?
Why is Bitcoin Blockchain known as Public Ledger?
If you want to know the answers to all these questions, please watch the next video.
Hope this is helpful! Bye!
