What is the difference between a cipher and a hash?

A cipher is an algorithm used to encrypt and decrypt data, while a hash is a one-way algorithm used to generate a unique fixed-length output from a given input.

Cipher example: AES (Advanced Encryption Standard) is a type of cipher used to encrypt and decrypt data.

Hash example: SHA-256 (Secure Hash Algorithm) is a type of hash used to generate a unique fixed-length output from a given input.

What is the difference between a digital signature and a hash?

A digital signature is a type of electronic signature that is used to verify the authenticity and integrity of a digital document or message. It is created by encrypting a message with a private key, which can then be decrypted with the public key. For example, when signing a contract online, a digital signature can be used to verify that the sender is who they say they are and that the document has not been altered.

A hash, on the other hand, is a one-way cryptographic algorithm that produces a fixed-length output from an input of any length. It is used to verify the integrity of a file or message, as any change to the input will result in a completely different output. For example, a hash can be used to verify that a file has not been modified or corrupted in any way.