CBCP Cryptography and Hashing 3 — Questions and Answers
Question 1: What is the output size of the SHA-256 hash function?
- 128 bits
- 160 bits
- 256 bits (Correct answer)
- 512 bits
Correct answer: 256 bits
SHA-256 always produces a fixed 256-bit (32-byte) digest regardless of input size.
Question 2: Which attack attempts to find any second input that hashes to the same value as a given first input?
- Birthday attack
- Preimage attack
- Second preimage attack (Correct answer)
- Length extension attack
Correct answer: Second preimage attack
A second preimage attack tries to find m2 ≠ m1 such that H(m2) = H(m1), given a known message m1 and its hash.
Question 3: What advantage does Schnorr signature aggregation offer over ECDSA in blockchain systems?
- Shorter private keys
- Multiple signatures can be combined into one, reducing data size (Correct answer)
- It eliminates the need for hashing
- It enables symmetric encryption of transactions
Correct answer: Multiple signatures can be combined into one, reducing data size
Schnorr signatures support linear aggregation, allowing multiple signers' signatures to be merged into a single compact signature, improving scalability.
Question 4: Which property ensures that even a one-bit change in input causes roughly half the output bits to flip in a hash function?
- Determinism
- Avalanche effect (Correct answer)
- Preimage resistance
- Uniform distribution
Correct answer: Avalanche effect
The avalanche effect means tiny input changes cause drastically different hash outputs, preventing any correlation between similar inputs and outputs.
Question 5: In Ethereum, which hashing algorithm is used natively for account addresses and state trees?
- SHA-256
- BLAKE2b
- Keccak-256 (SHA-3 variant) (Correct answer)
- RIPEMD-160
Correct answer: Keccak-256 (SHA-3 variant)
Ethereum uses Keccak-256 (the original SHA-3 submission, not the finalized NIST SHA-3 standard) for hashing throughout its protocol.
Question 6: What is a rainbow table attack, and how does salting defend against it?
- An attack exploiting weak RNG; salting adds entropy to the key generation
- A precomputed hash-to-plaintext lookup attack; salting adds a unique random value to each input before hashing (Correct answer)
- An attack on elliptic curves; salting randomizes curve parameters
- A side-channel attack; salting masks timing information
Correct answer: A precomputed hash-to-plaintext lookup attack; salting adds a unique random value to each input before hashing
Salting prepends or appends a unique random value to each password before hashing, making precomputed rainbow tables useless since each salt produces different hashes.
Question 7: Which cryptographic concept underlies the generation of a Bitcoin address from a public key?
- Symmetric encryption
- One-way hash chaining (SHA-256 then RIPEMD-160) (Correct answer)
- RSA padding
- Diffie-Hellman exchange
Correct answer: One-way hash chaining (SHA-256 then RIPEMD-160)
A Bitcoin address is derived by applying SHA-256 and then RIPEMD-160 to the public key, producing a shorter, one-way-derived identifier.
What is the output size of the SHA-256 hash function?