Professional Documents
Culture Documents
Hash Function
Hash Function
A hash function is a computer program that takes in any data, such as a text message or a file, and
produces a unique digital signature (a fixed-size sequence of numbers and letters) that represents the
original data. The purpose of the hash function is to make sure that the data has not been tampered
with or modified during transmission or storage.
A hash function is a mathematical function that takes in an input (or message) of arbitrary size and
produces a fixed-size output called a hash, digest, or fingerprint. The output of a hash function is
typically a sequence of bytes or a hexadecimal string that represents a unique digital signature of the
input data.
The input to the hash function is of arbitrary length but output is always of fixed length.
Hash functions are extremely useful and appear in almost all information security applications.
Ex Syril Tolledo –
Ex 2 Syril
MD5 Hash 6c872c8d5385f493385b55d99f3412f3
3d15f9d94289f42c743b0ee7070924c5
eb6b5afb093fb9b4363e10236ebe18383d9fce6a
Hash functions are versatile tools that are used for various purposes including efficient and secure data
storage, data authentication, digital signatures, password storage, indexing and searching large amounts
of data, and in the context of cryptocurrency and blockchain technology. They generate unique
fingerprints or hash values for each piece of data, which can be used as keys to store data in hash tables,
verify the authenticity and integrity of digital documents, store passwords securely, and generate
tamper-proof digital signatures for each block in a blockchain, ensuring the security and integrity of the
system.
1. Data storage
Hash functions are often used to store data in a way that is efficient and secure. Hash values are used as
keys to store data in hash tables, which are commonly used in databases, file systems, and caching
systems.
2. Data authentication
Hash functions can be used to ensure the integrity of data by generating a unique fingerprint, or hash
value, for each piece of data. If the data changes in any way, the hash value will also change, indicating
that the data has been tampered with.
3. Digital signatures
Hash functions are used in digital signature schemes to ensure the authenticity and integrity of digital
documents. The hash value of a document is signed with a private key, and the signature can be verified
using the corresponding public key.
4.Password storage
Hash functions are used to store passwords securely by generating a hash value of the password and
storing it instead of the actual password. When a user logs in, the system generates a hash value of the
entered password and compares it to the stored hash value to authenticate the user.
Hash functions are an essential component of blockchain technology used in cryptocurrencies such as
Bitcoin and Ethereum. Hash functions are used to generate unique, tamper-proof digital signatures for
each block in the blockchain, ensuring the security and integrity of the system.
Uniformity
A good hash function should map the expected inputs as evenly as possible over its output range. That
is, every hash value in the output range should be generated with roughly the same probability.
Efficiency
The hash function should be computationally efficient and quick to compute the hash value for any
input.
Deterministic
Given the same input, the hash function should always produce the same output.
Uniqueness
It should be very difficult to find two different inputs that produce the same hash value. This property is
also known as collision resistance.
Cryptanalysis
Cryptanalysis is the process of studying cryptographic systems to look for weaknesses or leaks of
information. Cryptanalysis is generally thought of as exploring the weaknesses of the underlying
mathematics of a cryptographic system, but it also includes looking for weaknesses in implementation,
such as side channel attacks or weak entropy inputs.
Cryptology has two parts namely, Cryptography which focuses on creating secret codes and
Cryptanalysis which is the study of the cryptographic algorithm and the breaking of those secret codes.
The person practicing Cryptanalysis is called a Cryptanalyst. It helps us to better understand the
cryptosystems and helps us improve the system by finding any weak point and thus work on the
algorithm to create a more secure secret code. For example, a Cryptanalyst might try to decipher a
ciphertext to derive the plaintext. It can help us to deduce the plaintext or the encryption key.
Ciphertext is also known as encrypted or encoded information because it contains a form of the
original plaintext that is unreadable by a human or computer without the proper cipher to decrypt it.
Historical ciphers
- Substitution cipher
In a Substitution cipher, any character of plain text from the given fixed set of characters is
substituted by some other character from the same set depending on a key. For example with a
shift of 1, A would be replaced by B, B would become C, and so on.
Example
Caesar cipher 3 shift
Example Syril Tolledo - Vbvko Wrlohgr
Different types
Caesar, monoalphabetic, polyalphabetic, homophonic cipher
- Transposition Cipher
A transposition cipher is a type of encryption method in which the letters or characters in the
original message (plaintext) are rearranged or shuffled in a specific way to produce the
encrypted message (ciphertext).
Example
Rail Fence Cipher
Syril Tolledo – SloloyiedrTlo
S...l...o..
.y..i...e.d
..r..T.l.o.
Different types
General principle.
Rail Fence cipher.
Scytale.
Route cipher.
Columnar transposition.
Double transposition.
Myszkowski transposition.
Disrupted transposition.
Different types
Vigenère cipher
Beaufort Cipher
Porta Cipher
Running Key Ciphe
Autokey cipher