Skip to content

cryptography#

Deriving Cryptographic Keys with HKDF in Rust using Ring

Ring is a popular Rust cryptography library which has support for generating cryptographic keys from a single input key using HKDF, the HMAC-based Extract-and-Expand Key Derivation Function. As you will see in this post, the ring::hkdf module supports securely generating pseudorandom bytes using the Salt::extract and Prk::expand methods implemented in the library.

Cryptographic Hash Functions in Rust using Ring

Ring is an open source cryptography library that implements cryptographic primitives and is designed to have an easy to use interface. It is implemented in Rust, C and assembly and most of the C and assembly language code in ring comes from BoringSSL. It supports the following features:

  • Authenticated Encryption with Associated Data (AEAD)

  • Key agreement

  • Constant-time operations

  • Hash functions and digests

  • Hashed based Message Authentication Codes (HMAC)

  • Key Derivation Functions (KDF)

  • Cryptography pseudo-random number generation

  • Public key cryptography and digital signatures

  • Serialization and deserialization

You can find the documentation for the library here and the Github link here.