Cryptography is the practice and study of techniques for secure communication in the presence of adversarial behaviour.

The following is a list of primitives one may want to accomplish using cryptography

Data Representation

Storing plain versions of some data is often risky (e.g. passwords.) Can we create one-way functions that transform potentially large amounts of data or sensitive data into a unique1 value that can be used for comparison or addressing.

The main primitive for this are hash functions which can enable content-addressed storage (e.g. CIDs)

Secure Communication

Encryption can be used to make sure that only intended recipients can receive the message or data you want.

Mostly accomplished using

  1. Symmetric Key Cryptography (e.g. RSA or ECC)
  2. Asymmetric Key Cryptography

Message integrity and Authentication

  1. Integrity: can the recipient be confident that the message has not been accidentally modified?
  2. Authentication: can the recipient be confident that the message originates from the sender?
  3. Non-repudiation: can the message’s authenticity be unchallengeable? (i.e. if I send a message, I can’t later maintain I did not)

There are multiple ways of accomplishing this:

  1. Hash functions
  2. MACs
  3. Digital Signatures

Guarantees

HashMACDigital Signature
IntegrityYesYesYes
AuthenticationNoYesYes
Non-repudiationNoNoYes
Kind of keysNoneSymmetricAsymmetric

Efficiency

MACs can be computed three orders of magnitude faster than digital signatures. For example, a 200MHz Pentium Pro takes 43ms to generate a 1024-bit modulus RSA signature of an MD5 digest and 0.6ms to verify the signature, whereas it takes only 10.3 to compute the MAC of a 64-byte message on the same hardware in our implementation. There are other publickey cryptosystems that generate signatures faster, e.g., elliptic curve public-key cryptosystems, but signature verification is slower.

Footnotes

  1. Up to the limits of probability (e.g. more unlikely than picking the same grain at random as someone else on the beach)