u3-cs
u3-cs
A cryptographic hash function (CHF) is an equation that is widely used to verify the validity of
data. It has many applications, particularly in information security (e.g. user authentication). A
CHF translates data of various lengths of the message into a fixed-size numerical string the
hash. A cryptographic hash function is a single-directional work, making it extremely difficult to
reverse to recreate the information used to make it.
• The hash function accepts data of a fixed length. The data block size varies between
algorithms.
• If the blocks are too small, padding may be used to fill the space. However, regardless of
the kind of hashing used, the output, or hash value, always has the same set length.
• The hash function is then applied as many times as the number of data blocks.
A hash function in cryptography takes a plaintext input and produces a hashed value output of a
particular size that cannot be reversed. However, from a high-level viewpoint, they do more.
• Protect passwords and operate at various speeds: Many websites allow you to save
your passwords so that you don't have to remember them each time you log in.
However, keeping plaintext passwords on a public-facing server is risky since it exposes
the information to thieves. Websites commonly use hash passwords to create hash
values, which they then store.
Message Authentication
• MACs are widely used between two parties that share a secret key for authentication
purposes. A MAC function uses a secret key and data block to generate a hash value,
that identifies the protected communication.
Data Integrity Check
• Hash functions are most commonly used to create checksums for data files.
• This program offers the user with assurance that the data is correct.
• The integrity check allows the user to detect any modifications to the original file.
• It does not assure uniqueness. Instead of altering file data, the attacker can update the
entire file, compute a new hash, and deliver it to the recipient.
Digital Signatures
• Digital signatures encrypt message hash values using a user's private key.
• The digital signature may be verified by anybody who knows the user's public key.
A firewall is a security system that controls the traffic flowing in and out of a network. It helps
protect systems and data from various online threats. The main advantages of having a firewall
are:
1. Access Control: Firewalls decide what data can enter or leave a network, ensuring only
authorized users and systems can connect.
2. Protection from External Threats: Firewalls block malicious traffic, like hackers,
viruses, and malware, from entering the network and causing harm.
3. Monitoring and Logging: Firewalls keep track of all network activity, which helps to spot
suspicious behavior and provide records for security checks.
4. Enforcing Security Policies: Firewalls make sure the network follows security rules,
allowing only specific types of traffic and blocking harmful or unnecessary ones.
6. Preventing Data Leaks: Firewalls can block the flow of confidential data outside the
network, preventing data theft or leakage.
7. Filtering and Segmentation: Firewalls can filter traffic based on rules and segment the
network, isolating sensitive areas to make them harder to attack.
Design Issues for Firewalls
When designing a firewall, several important factors need to be considered to ensure it works
well and offers proper security. Here are some key design issues:
1. Type of Firewall:
o Packet-Filtering Firewalls: Check each piece of data (packet) that comes into
or leaves the network and decide whether to allow it based on simple rules (like
IP addresses).
o Proxy Firewalls: Act as a middleman between the internal network and external
users, hiding the network’s details for extra security.
2. Performance and Scalability: The firewall must be fast and handle large amounts of
data without slowing down the network. It should also be able to grow with the network
as it expands.
3. Granularity of Access Control: Firewalls need to find a balance between being too
strict and too lenient. Too many rules might block legitimate traffic, while too few can
allow attacks.
4. Rule Set Complexity: Setting up rules for a firewall must be clear and simple. Complex
or poorly set rules can create security risks or lead to operational problems.
6. Integration with Other Security Systems: Firewalls should work together with other
security tools like antivirus software and intrusion detection systems to offer better
protection.
7. Network Address Translation (NAT): NAT hides internal network addresses from
external networks, but it may complicate some services that need direct access, like
video calls or peer-to-peer connections.
9. Transparency and Stealth: Firewalls should not reveal information about the internal
network to attackers, making it harder for them to find weaknesses.
10. Encrypted Traffic Inspection: With more traffic being encrypted (like HTTPS), firewalls
must be able to check this encrypted data for hidden threats without compromising
privacy.
Feature Substitution Cipher Transposition Cipher
Decryption Requires knowing the substitution Requires knowing the exact method for
Process rule or key. reversing the rearrangement.
In a Caesar cipher, each letter in the plaintext is shifted by a certain number of positions in the
alphabet.
Example:
• Plaintext: HELLO
In this case, each letter of the plaintext is replaced by the letter three positions later in the
alphabet:
• H→K
• E→H
• L→O
• L→O
• O→R
In a Rail Fence cipher, the letters of the plaintext are written in a zigzag pattern across multiple
"rails" (rows) and then read off row by row to create the ciphertext.
Example:
H...O...R...
.E.L.W.L.D.
..L...O....
• Rail 1: HOR
• Rail 2: ELWLD
• Rail 3: LO
The output is usually a hash (e.g., The output is ciphertext, which is the
Output
256-bit hash in SHA-256). encrypted version of the original data.
A hashing algorithm is a mathematical function that takes an input (or "message") and
produces a fixed-size string of characters, which is typically a digest that uniquely represents
the data.
1. Fixed Output Size: Regardless of the input size, a hashing algorithm always produces a
fixed-length output (e.g., 256-bit or 512-bit). This is useful for comparing large files or
verifying data without needing to store the full input.
2. Deterministic: For the same input, a hashing algorithm will always produce the same
output. This property is useful for checking data integrity and consistency.
3. Collision Resistance: It is very hard to find two different inputs that produce the same
hash output (this is known as a collision). A good hashing algorithm minimizes the
chance of collisions.
4. One-Way Function: It is computationally infeasible to reverse the hash back to the
original input. This is why hashes are used for things like password storage – even if
someone sees the hash, they cannot retrieve the original password.
5. Small Change in Input, Big Change in Output: A minor change in the input (even
changing one letter) results in a completely different hash. This ensures that even small
data changes are easily detectable.
What is Cryptography?
Cryptography is the practice of securing communication and information through the use of
mathematical algorithms. It is used to protect the confidentiality, integrity, authenticity, and
non-repudiation of data during transmission or storage. In simpler terms, cryptography is about
keeping information safe and ensuring that only authorized individuals can access it or alter it.
Cryptography plays a vital role in various fields such as securing online banking, e-commerce,
military communication, and data privacy. It ensures that sensitive information such as
passwords, credit card details, and personal messages is protected from unauthorized access
or tampering.
Cryptographic algorithms are the mathematical procedures used to encrypt and decrypt data.
They can be divided into several categories based on how they function and their purpose. The
main types of cryptographic algorithms are:
o In symmetric key algorithms, the same key is used for both encryption and
decryption. Both the sender and the receiver must have the same secret key.
o Advantages: These algorithms are generally faster and efficient for large
amounts of data.
o Disadvantages: The biggest challenge is securely sharing the key. If the key is
intercepted, the entire communication is compromised.
Example:
o AES: A widely used symmetric encryption standard, known for its efficiency and
strong security. AES supports key sizes of 128, 192, or 256 bits.
2. Asymmetric Key Algorithms (also known as Public Key Cryptography):
o Asymmetric encryption uses two different keys: a public key (used for
encryption) and a private key (used for decryption). The public key can be freely
distributed, while the private key is kept secret.
o The main benefit of asymmetric encryption is that it solves the key distribution
problem. Even if the public key is intercepted, only the private key can decrypt
the message.
o Advantages: The key distribution problem is solved because the private key
never needs to be shared.
o Disadvantages: These algorithms are slower and less efficient for encrypting
large amounts of data.
Example:
o RSA: One of the most common asymmetric encryption algorithms, used for
secure data transmission. It relies on the difficulty of factoring large prime
numbers.
3. Hash Functions:
o Hash functions are cryptographic algorithms that take an input (or "message")
and return a fixed-length string of characters, which is typically a hash value or
hash code. Hashing is one-way (it cannot be reversed) and is commonly used
for verifying data integrity and storing passwords securely.
o Example: SHA-256 (part of the SHA-2 family), MD5 (though MD5 is considered
weak now).
Example:
The public key infrastructure uses a pair of keys: the public key and the private key to achieve
security. The public keys are prone to attacks and thus an intact infrastructure is needed to
maintain them.
The security of a cryptosystem relies on its keys. Thus, it is important that we have a solid key
management system in place. The 3 main areas of key management are as follows:
o Keeping the private key secret: Only the owner of a private key is authorized to
use a private key. It should thus remain out of reach of any other person.
o Assuring the public key: Public keys are in the open domain and can be publicly
accessed. When this extent of public accessibility, it becomes hard to know if a
key is correct and what it will be used for. The purpose of a public key must be
explicitly defined.
PKI or public key infrastructure aims at achieving the assurance of public key.
1. Key Generation:
o PKI provides tools and protocols for generating a pair of keys (public and private)
securely. These keys must be mathematically related, and the private key must
remain confidential while the public key is shared with others.
o Example: The RSA algorithm is commonly used within PKI for key generation.
2. Key Distribution:
o The public key must be shared with the communicating parties, and PKI provides
a way to distribute public keys securely. Without PKI, sharing public keys
securely can be difficult, as attackers might impersonate others and provide
fake keys.
o Role of PKI: PKI ensures that a public key truly belongs to the claimed entity by
using digital certificates, which link the public key to the identity of its owner.
3. Digital Certificates:
o These certificates are issued and signed by Certificate Authorities (CAs), trusted
third parties that vouch for the identity of the public key owner.
Example: When you visit a website with HTTPS, the server's identity is verified by a digital
certificate, which contains the server’s public key.
o Certificate Authorities (CAs) are trusted entities within PKI that issue and sign
digital certificates. The CA verifies the identity of the entity requesting the
certificate and ensures that the public key is properly associated with that entity.
o The CA is critical for making public key encryption secure because it ensures
that the public keys exchanged between parties are authentic.
5. Digital Signatures:
o PKI is also used for creating and verifying digital signatures, which are a
combination of public key encryption and hashing. A person can sign a
document using their private key, and anyone can verify the signature using their
public key.