enum

Beryl::TLS::HashAlgorithm

Inherits Enum < Comparable < Value < Object

The two hashes a TLS 1.3 key schedule runs on (RFC 9846 §7.1): SHA-256 for the AES-128-GCM and ChaCha20-Poly1305 suites, SHA-384 for AES-256-GCM. Each call goes to Beryl's own SHA-2, HMAC and HKDF.

Constants

SHA256 = 0
SHA384 = 1

Instance methods

authenticate(message : Bytes, *, key : Bytes) : Bytes

Returns HMAC of message under key.

Source
bytesize

The digest size in bytes.

Source
digest(message : Bytes) : Bytes

Returns the hash of message.

Source
empty_digest

Returns the hash of the empty string.

Source
expand(pseudorandom_key : Bytes, *, info : Bytes, bytesize : Int32) : Bytes

HKDF-Expand (RFC 5869 §2.3).

Source
extract(input_key_material : Bytes, *, salt : Bytes) : Bytes

HKDF-Extract (RFC 5869 §2.2).

Source
sha256?

Returns true if this enum value equals SHA256

Source
sha384?

Returns true if this enum value equals SHA384

Source
verify(message : Bytes, tag : Bytes, *, key : Bytes) : Bool

Returns whether tag is HMAC of message under key, compared in constant time.

Source