Skip to content

Lockstitch is an incremental, stateful cryptographic primitive for symmetric-key cryptographic operations (e.g. hashing, encryption, message authentication codes, and authenticated encryption) in complex protocols.

License

Notifications You must be signed in to change notification settings

codahale/lockstitch

Repository files navigation

Lockstitch

Lockstitch is an incremental, stateful cryptographic primitive for symmetric-key cryptographic operations (e.g. hashing, encryption, message authentication codes, and authenticated encryption) in complex protocols. Inspired by TupleHash, STROBE, Noise Protocol's stateful objects, Merlin transcripts, and Xoodyak's Cyclist mode, Lockstitch uses TurboSHAKE128, an eXtendable Output Function (XOF), and AEGIS-128L, an authenticated cipher, to provide 100+ Gb/sec performance on modern processors at a 128-bit security level.

CAUTION

⚠️ You should not use this. ⚠️

Neither the design nor the implementation of this library have been independently evaluated. The design is documented in design.md; read it and see if the arguments therein are convincing.

In addition, there is absolutely no guarantee of backwards compatibility.

Design

A Lockstitch protocol is a stateful object which has five different operations:

  • Init: Initializes a protocol with a domain separation string.
  • Mix: Mixes a piece of data into the protocol's transcript, making all future outputs dependent on it.
  • Derive: Outputs bytes of pseudo-random data dependent on the protocol's transcript.
  • Encrypt/Decrypt: Encrypts and decrypts data using the protocol's transcript as the key.
  • Seal/Open: Encrypts and decrypts data with authentication using the protocol's transcript as the key.

Using these operations, one can construct a wide variety of symmetric-key constructions.

Use