Three mechanisms address different questions
Hashing maps bytes to a fixed-length digest for content comparison; it is not encryption that a key reverses. Encryption allows an appropriate key holder to recover data and addresses secrecy. Modern systems also need ciphertext integrity, typically through mature authenticated-encryption interfaces.
A digital signature is produced with a private key and verified with the corresponding public key. It supports integrity and signer-origin verification without hiding document contents. Verification also depends on trusting the relationship between the public key and the claimed identity.
Further reading: Python: hashlib·NIST FIPS 186-5: Digital Signature Standard
Algorithms need key custody and process
If a private key leaks, an attacker may produce apparently valid signatures. If a recipient accepts an attacker-supplied public key, verification may authenticate the wrong identity. Address key storage, rotation, revocation and trusted distribution.
This unit practices mechanism selection and revisits the hash example. Do not design custom cryptographic algorithms or treat teaching strings as real keys. Protection must be assessed within the complete protocol and deployment context.
Example: public downloads and private research files
A public course download should let readers verify consistency with the publisher. A private research file additionally needs restricted reading.
A trusted digest supports content comparison. A signature under a trusted public key adds signer verification. Private files additionally need appropriate encryption and access controls. A valid signature does not make a file confidential.
Conclusion: Combine mechanisms by requirement and verify content, origin and confidentiality separately.
Tabletop exercise: match goals to mechanisms
Use fictional requirements without creating or exposing real keys.
- List download digest comparison, private-file secrecy and publisher-signature verification.
- Match them to hashing, encryption and digital signatures.
- Add one trust or key assumption to each match.
Expected result
Digest comparison needs a trusted reference; encryption needs protected keys; signatures need trusted public keys and private-key custody.
Check your work
With a valid signature but an unknown public-key origin, which identity claim remains unestablished?
Finish and clean up
Save the mapping. No keys or secrets were created.