1 - Cryptography Basics
Summary
TLDRThis script delves into the world of cryptography, a practice as old as communication itself. It explains the fundamental need for secure messaging and introduces the concept of transforming readable messages into unreadable 'ciphertext' to prevent unauthorized access. The script covers encryption and decryption algorithms, distinguishing between symmetric and asymmetric methods, and highlights the importance of key sizes in security. It also explores hashing algorithms, emphasizing their role in ensuring message integrity rather than confidentiality, and explains the use of HMAC for user authentication in secure communications.
Takeaways
- đ Cryptography is an ancient concept, designed to secure messages from unauthorized access.
- đ The core of cryptography is transforming readable plain text into unreadable cipher text to ensure security during transmission.
- đ The process involves both encryption, converting plain text to cipher text, and decryption, converting cipher text back to plain text.
- đ Keys are essential in cryptography, used in conjunction with algorithms to encrypt and decrypt messages, ensuring that only authorized parties can read the content.
- đđ Symmetric algorithms use the same key for both encryption and decryption, while asymmetric algorithms use a pair of keys, one for each process.
- đđ Asymmetric algorithms, like RSA, have larger key sizes and require more computational resources, making them slower but also more secure.
- đ Advanced Encryption Standard (AES) is considered a highly secure symmetric algorithm, with variable key sizes up to 256 bits.
- đ Hashing algorithms are one-way functions that create a digital fingerprint of data, ensuring the integrity but not the confidentiality of the message.
- đ Different hashing algorithms, such as MD5, SHA-1, and SHA-2, have varying levels of security and generate hash files of different lengths.
- đđ Hashed Message Authentication Code (HMAC) combines hashing with a secret key to verify both the integrity and authenticity of a message.
- đ HMAC is used in protocols like SSL to ensure secure communication, demonstrating the practical applications of cryptographic techniques.
Q & A
What is the fundamental purpose of cryptography?
-The fundamental purpose of cryptography is to transform a message into a secure form so that unauthorized individuals cannot read the content of the message.
What is the difference between plaintext and ciphertext?
-Plaintext is a readable message, while ciphertext is the result of an encryption process that makes the message unreadable to anyone without the decryption key.
What is an encryption algorithm?
-An encryption algorithm is a process used to convert plaintext into ciphertext, ensuring the message is secure from unauthorized access.
Why is a key necessary in the encryption process?
-A key is necessary to ensure that only those with the correct key can decrypt the ciphertext back into plaintext, thus maintaining the confidentiality of the message.
What are the two main types of encryption algorithms?
-The two main types of encryption algorithms are symmetric algorithms, which use a single key for both encryption and decryption, and asymmetric algorithms, which use a pair of keys, one for encryption and one for decryption.
What is the difference between symmetric and asymmetric encryption algorithms?
-In symmetric encryption, the same key is used for both encryption and decryption, while in asymmetric encryption, a public key is used for encryption and a private key, known only to the recipient, is used for decryption.
What is the Advanced Encryption Standard (AES)?
-The Advanced Encryption Standard (AES) is a widely used symmetric encryption algorithm that can work with multiple key sizes, such as 128, 192, or 256 bits, making it highly secure.
Why are larger key sizes in encryption algorithms considered more secure?
-Larger key sizes make it computationally more difficult for unauthorized individuals to crack the encryption through brute force methods, thus enhancing the security of the encryption.
What is a hashing algorithm and how does it differ from encryption algorithms?
-A hashing algorithm is a one-way function that converts an input message into a fixed-size output called a hash or digest. Unlike encryption, it is not meant to be decrypted; it is used to verify the integrity of the message.
What is the purpose of a hashing algorithm in the context of message integrity?
-The purpose of a hashing algorithm is to ensure that the message has not been altered in any way during transmission. The recipient can verify the integrity by generating a hash of the received message and comparing it with the hash provided by the sender.
What is Hashed Message Authentication Code (HMAC) and how is it used for message authentication?
-HMAC is a technique that combines a hashing algorithm with a secret key to provide an additional layer of security and authentication. It ensures that the message came from the claimed sender and has not been tampered with during transmission.
Why might asymmetric encryption be slower than symmetric encryption?
-Asymmetric encryption might be slower than symmetric encryption because it requires more computational power to handle the larger key sizes and the more complex mathematical operations involved in the encryption and decryption processes.
Outlines
đ Cryptography: The Art of Secure Communication
This paragraph introduces the fundamental concept of cryptography, which has been in existence for thousands of years to address the concern of unauthorized access to messages. It explains that cryptography is the practice of transforming readable messages (plain text) into a non-readable form (cipher text) to prevent unauthorized reading. The process involves using an encryption algorithm along with a key to encode the message, and the same key is required to decode it back to plain text. The paragraph also distinguishes between symmetric and asymmetric encryption algorithms, highlighting the use of a single key in symmetric algorithms like DES and triple DES, and two different keys in asymmetric algorithms like RSA. It concludes by emphasizing the importance of the key in maintaining the security of the message.
đïž Key Sizes and Encryption Strength
The second paragraph delves into the importance of key size in encryption algorithms, illustrating how larger keys contribute to stronger encryption. It mentions the Data Encryption Standard (DES) with a 56-bit key and the Advanced Encryption Standard (AES), which supports variable key sizes of 128 or 256 bits. The paragraph also discusses the trade-offs between symmetric and asymmetric algorithms, noting that while asymmetric algorithms offer larger key sizes and are more secure, they require more computational resources and can slow down communication. Additionally, it introduces hashing algorithms as a third type of cryptographic function, which are one-way and used to ensure the integrity of a message rather than its confidentiality.
đ Hashing Algorithms and Their Applications
This paragraph focuses on hashing algorithms, which are used to create a digital fingerprint or a fixed-size digest of a message. It explains that hashing is a one-way process and contrasts it with the two-way encryption process. The paragraph lists various hashing algorithms, including MD5, SHA-1, SHA-2, and RIPEMD, and discusses their evolution and the increasing security they offer with larger hash sizes. It also describes how hashing is used in applications like HMAC (Hash-based Message Authentication Code) to authenticate the sender of a message by using a shared secret key in conjunction with a hashing algorithm.
đ HMAC and Its Role in Secure Communications
The final paragraph discusses the application of HMAC in secure communications, particularly in protocols like SSL. It provides a practical example of how HMAC can be used between two users, Alice and Bob, to ensure that a message indeed comes from the claimed sender. The process involves Alice encrypting a message with a shared secret key and generating a hash file using a hashing algorithm. She then sends the hash file and the encrypted message to Bob. Upon receipt, Bob uses the same hashing algorithm and secret key to verify the hash file's integrity, confirming the message's authenticity before decrypting it. This use case highlights the importance of HMAC in maintaining both the integrity and authenticity of messages in digital communications.
Mindmap
Keywords
đĄCryptography
đĄPlain Text
đĄCipher Text
đĄEncryption Algorithm
đĄKey
đĄSymmetric Algorithm
đĄAsymmetric Algorithm
đĄHashing Algorithm
đĄDigest
đĄHMAC
đĄSSL Protocol
Highlights
Cryptography has been a concept for thousands of years, addressing the concern of unauthorized access to messages.
Cryptography is the art of transforming a message into a secure form to prevent unauthorized reading.
The process involves converting plain text to ciphertext, making it unreadable without the proper key.
Encryption algorithms are used to convert plain text to ciphertext and vice versa.
A key is essential in cryptography to ensure that only authorized parties can decrypt the message.
There are two types of encryption algorithms: symmetric and asymmetric.
Symmetric algorithms use a single key for both encryption and decryption.
Asymmetric algorithms use a pair of keys, one for encryption and another for decryption.
Data Encryption Standard (DES) and Triple DES are examples of symmetric algorithms.
Advanced Encryption Standard (AES) is widely used and considered highly secure.
Key size in encryption algorithms affects the strength of the encryption.
Asymmetric algorithms require more computational resources and are slower than symmetric ones.
Hashing algorithms are one-way functions used to ensure the integrity of a message.
Hashing algorithms produce a fixed-size digest or digital fingerprint of the input message.
MD5, SHA-1, and SHA-2 are examples of popular hashing algorithms with varying levels of security.
HMAC is used for message authentication by combining a secret key with a hashing algorithm.
SSL protocol utilizes HMAC for secure communication.
The choice between symmetric and asymmetric algorithms depends on the application's need for speed and security.
Transcripts
cryptography is a concept that has been
around for
thousands of years so it's not something
new
and the reason for that is that people
have always had this concern that when
they send a message
to a recipient someone unauthorized get
access to that message and read the
content of the message
now that message could be something that
a general is sending to
another general or it could be something
that you know a person is sending to
another family member
so cryptography is an answer to that
concern
now what is cryptography it's basically
the art of
transforming a message into a secure
form so that
someone unauthorized cannot read the
content of the message
so we're transforming a clear text
message
to some gibberish that is not readable
and understandable by people
so you have a plain text a readable
message
and you send that readable message
through some processes
and in that processes the message gets
converted to
something which is not readable to some
gibberish that
if somebody gets access to that message
they cannot read it
so that uh message which is not readable
is called ciphertext so i have plain
text
i send it through some processes and
then i get
cipher text now during this process
you're basically encoding your message
or you're in ciphering the message now
when the recipient receive
this message they cannot read the
message either
so what they do is they have to send
that message
through the same processes and get the
message converted back to something
which is readable which we call it plain
text
now this process of converting message
from plain text to ciphertext
is called encryption algorithm so the
whole process
is called algorithm and when you use it
for encryption
we call it encryption algorithm now the
problem with
this process of converting plaintext to
ciphertext
using an encryption algorithm is that if
an
unauthorized person gets access to the
ciphertext
and if they come to know what algorithm
you've used
then nothing stops them from sending
your ciphertext through the same
algorithm to get the plain text and read
the content of the message
now to address this issue
they have come up with a key so
when you're sending your message the
plaintext through the
encryption algorithm you send that key
to that algorithm too
so you use the key and plain text
together
in that algorithm to convert the plain
text message
to some gibberish or to cipher text so
i'm not going to say gibberish anymore
i'm going to say cipher text from now on
so now i have the ciphertext and
i use the plain text with the algorithm
and the key
to get that ciphertext so as i mentioned
before if you want to
convert the ciphertext to uh plain text
then you have to send that ciphertext
and the key to the same algorithm
and get your text converted back to
plain text
now the algorithm when it's used for
encryption
we call it encryption algorithm and when
we use the same algorithm for decryption
we call it decryption algorithm all
right
now that you know that we have an
algorithm that can be used for
transforming
a plain text to ciphertext or ciphertext
to plain text
you need to know that we have different
types of encryption algorithms
we basically have two types of
encryption algorithm
one is symmetric algorithm in symmetric
algorithm you use
one key to transform the plain text to
ciphertext
and you use exactly the same key to
transform the ciphertext to plaintext
the second type of algorithm is
asymmetric algorithm
now in asymmetric algorithm you have two
keys
you use one key for encryption and you
use the other key for decryption
if you use the first key for encryption
you have to use the second key for
decryption
you cannot use the first key for
decryption
and if you use the second key for
encryption then you have to use the
first key for
decryption that is the difference
between these two algorithms
now we have so many different algorithms
that are
categorized under symmetric and
asymmetric
so if you look at this slide we have a
data encryption standard that's
an encryption algorithm which is a
symmetric algorithm
we have a triple des which is basically
data encryption standard but you use it
three times
and the reason that you do that is to
make the algorithm
more stronger more secure
another type of algorithm that we have
which has been widely used nowadays and
it's the most secure one
is called advanced encryption standard
or aes
if you look at all these algorithms you
can see that they have different
sizes of keys that can be used with for
example data encryption is
a standard has a key of 50
56 bit so that means when you want to
use this algorithm
the key that you're going to use is
going to be 56 bits of
key you send that key and your text
to this algorithm to get the ciphertext
when it comes to advanced encryption
standard it can
work with multiple sizes of keys
you can have a key of size 128 bit
or 256 bit so the larger the size of
your key
the stronger your encryption can be and
the difference between this symmetric
algorithm is
basically the mathematic procedures that
they use
to convert the plaintext to ciphertext
now if the mathematic procedure is very
sophisticated
then that makes the algorithm more
powerful
stronger algorithm and if the key size
is longer
that makes even the algorithm stronger
now on the right side of screen you can
see we have asymmetric
algorithm and rsa is an example of that
we have more
asymmetric algorithms of course but i
have
just put the most popular one uh which
is rsa and it's been around for
quite a long time so as you can see the
size of the key with the
asymmetric algorithm is significantly
bigger than
what we have in symmetric algorithm now
you may be asking
that since asymmetry has larger key size
compared to a symmetric algorithm
why do we need to use symmetric
algorithm why don't we use asymmetric
algorithm for everything
well one reason for that is the
resources that you need to handle
asymmetry keys
for example if you're using asymmetric
key
the communication the speed of the
communication might be
much slower than symmetric algorithm and
you need a lot of
cpu power to handle asymmetric algorithm
imagine you're accessing a website using
a secure http protocol
and if that website uses asymmetric
algorithm all the way then the
communication with that website is going
to be really slow and you will see that
your cpu usage is going to be really
high to handle all these encrypted
traffics using asymmetric algorithm
the third type of cryptographic
algorithm that we have is called
hashing algorithm now the difference
between hashing algorithm and the
previous two
is that hashing algorithm is a one-way
algorithm
so when you encrypt your message you
cannot decrypt it back
and technically with hashing algorithm
you're not really
encrypting your message the result of
hashing algorithm is called
a digest or a digital fingerprint
or a hash file so when you send your
message through a hashing algorithm
it goes through some calculations some
mathematical procedures
and the end result is going to be a
digest of the file
or a hash of that file now you may be
asking
why do we need such an algorithm if i
cannot decrypt the message that i
encrypted
then what's the point of using this
algorithm
well that's a very good question that i
asked for you
in the symmetric and asymmetric
algorithm
you are encrypting a message so these
algorithms protect the confidentiality
and
integrity of the message hashing
algorithm
is just for the integrity of the message
because in hashing algorithm you don't
need to have a key you
just need to know the algorithm so when
i send a message to someone i just tell
them
what hashing algorithm i used and then
they can use the same algorithm to check
the integrity of the message that i sent
to them
now the way that this works is that when
i want to send the message to someone
else
i calculate a hash of that message
and then i send the message with the
hash file to the recipient
then when the recipient receives that
message they're going to use the
same hashing algorithm to generate a
hash of that file
if the produced hash is exactly the same
as the one that i sent to them
then they know that the message is
intact and
nothing with the content of that message
has been changed
so when you use this algorithm you don't
really care that
someone sees the content of your message
what you care is
the recipient receives the exact message
that you sent to them
now one thing about the hashing
algorithm
is that whether you send a letter a page
or 10 volume book as an input to the
hashing algorithm
the end result is going to be the same
size
now the same way that we had multiple
algorithms
with symmetric and asymmetric algorithms
in hashing also we have different types
of
algorithms and the main difference
between these
different algorithms is in the
mathematical calculation of the digital
fingerprint or the hash file
one of the earliest and most popular
hashing algorithm
is md5 or message digest five
now the five is the version of this
algorithm so it started from message
digest one and
two and then it reached the message
digest 5.
as you can see the length of the hash
file that is generated by message digest
5
or md5 is 128 bit so as i said whether
you send a letter
or a page to this uh hashing algorithm
the end result is going to be 128 bit
now later some vulnerabilities were
found with
md5 and then sha1 was
introduced as a more secure hashing
algorithm
as you can see sha generates a 106
bit hash file so whatever you send to
sha
1 the end result is going to be 160 bit
and then sha 1 also was found to be
a little bit vulnerable and then shot 2
was introduced as a more secure version
of
sha-1 and sha2 generates a different
hash sizes
as you can see the hash length can be
224 bit
all the way to 512 bit recently
shot 3 has been introduced as the most
secure version of
sha2 another type of hashing algorithm
that we have
is called race integrity primitives
evaluation message digest or
ripemd now this algorithm
was created by race which is a european
union affiliated
organization as you can see this
algorithm also generates
hash files in different sizes
now there are other hashing algorithms
out there but
what you see in these slides are the
most common and popular ones
one of the usage or applications of
the hashing algorithm is in hashed
message
authentication code as the name says
here this hashed message authentication
code is used for
authenticating a user let me explain how
it works
let's say we have two users alice and
bob
and these two uh when they send a
message to each other they want to make
sure that the message came from the
right person
so they want to use hmac for
authenticating each other
now both of these users have same secret
key so they both agreed on the same
encryption algorithm and they generated
as the same secret key to use with that
symmetric algorithm when they exchange
messages now let's say alice wants to
send a message to bob so
she uses the same secret key that they
have to encrypt that message
and then she uses a hashing algorithm
to generate a hash file for that
encrypted message
and the key the secret key that she has
the end result is gonna be a hash file
now
next thing that she's gonna do is send
this hash file and the encrypted message
to bob
when bob receives the message before
decrypting the message
he is going to make sure that the
message actually came from alice
so the way that he is going to do that
is by using the same hashing algorithm
he's gonna send the same encrypted file
and the secret key that he has to that
hashing algorithm
to generate a hash file then
when he generates that hash file he's
gonna compare that hash file with the
one that
alice sent to him if these two hash
files are exactly the same
then he knows that the message came from
alice because
alice is the one who has that key and
without that key there was no way that
bob could get the same
hash file so now that he knows that the
message came from alice
he can use the same secret key that he
has to decrypt the message
and see the content of that message so
that's how
the hashed message authentication code
works
one of the application of hmac is
in for example ssl protocol i'll talk
about ssl protocol in another lesson
but that's one of the application of
this hmac protocol
alright so that's it for this lesson and
i'll see you in another video
Voir Plus de Vidéos Connexes
5.0 / 5 (0 votes)