0% found this document useful (0 votes)
9 views23 pages

Week 4

Uploaded by

nu2su1tan10711
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views23 pages

Week 4

Uploaded by

nu2su1tan10711
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Cryptography

INF 203
Content

• Cryptography basics
• Encoding
• Hashing
• Encryption
Cryptography

• Cryptology: the study of secret writing.


• Steganography: the science of hiding messages in
other messages.
• Cryptography: the science of secret writing.
• Cryptanalysis: science of recovering the plaintext
from ciphertext without the key.
What’s it all about?
• How do we turn an insecure communication
facility (like the Internet) into a secure one?
• Where security means that one or more
security properties (e.g., confidentiality,
integrity, authentication, non-repudiation,
anonymity, unobservability, timeliness,
availability, etc.) are guaranteed.
• Cryptography is the enabling technology.
• Plaintext (or plain text, clear text, ...): text that can be read and “understood” (e.g., by
a human being).
General • Encryption: transformation (or function, process, procedure, ...) E that takes in input a
plaintext and a key and generates a ciphertext.
cryptographic • Ciphertext (or cipher text, encrypted text, ...): transformed (or “scrambled”, ...) text
schema that needs to be “processed” to be “understood” (e.g., by a human being).
• Decryption: transformation (or function, process, procedure, ...) D that takes in input
a ciphertext and a key and generates a plaintext.
Substitution Cipher

• Substitution ciphers involve replacing each


letter in the plaintext with another letter
according to a predetermined key.
• The key defines the mapping from plaintext
letters to ciphertext letters.

Types of Substitution Ciphers:


1. Caesar Cipher
2. Monoalphabetic Cipher
3. Polyalphabetic Cipher
Transposition Cipher

• Transposition ciphers involve rearranging the


order of the letters in the plaintext without
altering the actual letters.
• The key determines the method and pattern of
rearrangement.

Types of Transposition Ciphers:


1. Columnar Transposition
2. Rail Fence Cipher
3. Route Transposition
Caesar cipher

• Earliest known substitution cipher by Julius Caesar


• First attested use in military affairs
• Replaces each letter by the 3rd letter following
• Example:
o meet me after the toga party
o PHHW PH DIWHU WKH WRJD SDUWB
• Or:
o caesar
Define transformation (mapping scheme) as:
o FDHXDV
abcd e fghi j k l mn opq r s t u vwxy z
DEFGHI JKLMNOP QR ST UVWXY ZABC
Cryptography
basics
• You might have met some terms
as encoding, encryption, hashing
and so on. But what’s the
difference between all these
terms?
Encoding
• Encoding is the process of converting data
from one form to another. From bits to
text,
• from text to text and so on. These process
is reversable.
• If someone encode some data, you can
easily decode it if you know/guess/brute
force the encoding.
Encoding
• Charset (character set) – set of symbols
that is used to represent the data after
encoding. Character map is a table that
maps symbol code to its charset
representation.
• For example, ASCII, Unicode.
Encoding
• URL Encoding (Percent encoding) - is a
mechanism for encoding information in a URI.
In fact, it used more generally within the main
Uniform Resource Identifier (URI) set, which
includes both Uniform Resource Locator (URL)
and Uniform Resource Name (URN).
• Also, it is used in the preparation of data of
the application/x-www-form- urlencoded
media type, that is often used in the
submission of HTML form.
Encoding
• Base64 Encoding is encoding that allows to represent
any binary file as text and transmit it over Internet. It
does not mean that it is used for binary only. Even text
can be encoded with Base64 encoding.
• Charset of Base64 is [0-9a-zA-Z] and ‘=‘ symbol.
• Please note that Base64-encoded images can be used
and rendered on the HTML page.
• One of the purposes of this encoding – to give ability for
text protocols (such as HTTP) to transfer binary data.
Encryption
• Encryption is transformation
process of the
message/text/other data in a
specific way that only
authorized parties can
access it.
• An authorized recipient can
easily decrypt the message
with the key provided by the
originator to recipients.
• There are different Encryption algorithms:

Encryption algorithms that use symmetrical key; algorithms


that use a pair (public and private) of keys.
Encryption algorithms

Symmetric encryption algorithms: Asymmetric encryption algorithms:

Blowfish Diffie-Helman
AES RSA
RC4 ECC
DES ElGamal
RC5 DSA
The Data Encryption Standard (DES)
• Algorithm Structure:
o DES operates on 64-bit blocks of plaintext and uses a 56-bit key for encryption and
decryption.
o The algorithm consists of 16 rounds of permutation and substitution (Feistel cipher
structure), each involving the use of the encryption key.
o During each round, the plaintext undergoes permutation and substitution operations
based on the key, resulting in a ciphertext block.
o The final ciphertext block is produced after all 16 rounds are completed.
Hashing
• A hash function is any function that can be
used to map data of arbitrary size to fixed-
size values. Hashing is the transformation
of a string of characters into a fixed-length
value (usually shorter) or key that
represents the original string.
• Usually, hashing is a one-way operation.
We assume there is only one possible way
to restore source text: brute forcing (in
some cases rainbow tables might help to
brute force faster)
Hashing
• Cryptographic hash function must have six main properties:
• Deterministic: the same message always results in the same hash;
• Quick: it is quick to compute the hash value for any given message;
• One-way function: it is infeasible to generate a message from it’s hash value except brute forcing;
• Avalanche effect: a small change to a message should change the hash value so extensively that
the new hash value appears uncorrelated with the old hash value;
• Collision resistant: it is infeasible to find two different messages with the same hash value
• Pre-image attack resistant: a pre-image attack on cryptographic hash functions is aimed to find a
message that has a specific hash value. A cryptographic hash function should resist attacks on it’s
pre-image.
Hashing
Hashing
• The most known hashing algorithms:
1. MD5
2. SHA-1
3. SHA-256
4. SHA-512
Applications
of Hashing
• Data Integrity
• Password Storage
• Digital Signatures
• Data Indexing and Retrieval
Here are some free platforms
where students can train in
cryptography:
1. Cryptohack:
Cryptohack is a platform that offers free interactive challenges to help users learn and practice
cryptography. It covers various topics such as encryption, decryption, hashing, and more. Users can solve
challenges at their own pace and track their progress.
2. CryptoPals Crypto Challenges:
CryptoPals provides a series of cryptography challenges aimed at teaching cryptographic concepts through
hands-on exercises. The challenges cover a wide range of topics from basic encryption algorithms to more
advanced cryptographic protocols. Users can work through the challenges individually or in groups.

3. OverTheWire - Narnia:
OverTheWire hosts a collection of hacking and security challenges, including the Narnia series, which covers
basic cryptography concepts. Participants can solve challenges by exploiting vulnerabilities in cryptographic
implementations. The platform offers a fun and engaging way to learn cryptography.
4. HackerRank - Cryptography Challenges:
HackerRank offers a variety of coding challenges, including a section dedicated to cryptography. Participants
can solve challenges related to encryption, decryption, and other cryptographic operations using
programming languages such as Python, Java, and C++. The platform provides a supportive community and
resources to help users improve their skills.

You might also like