abstract class MbedTLS::Digest

Overview

Abstract base class for using the mbed TLS crypto library to produce digests for given data.

NOTE The Digest class cannot be directly instantiated. Use one of it's subclasses instead.

Included Modules

Direct Known Subclasses

Defined in:

digest/digest.cr

Class Method Summary

Instance Method Summary

Instance methods inherited from module MbedTLS::DigestBase

<<(data) <<, base64digest base64digest, digest digest, file(file_name) file, hexdigest hexdigest, to_s(io) to_s, update(io : IO) update

Class methods inherited from module MbedTLS::DigestBase

hexdump(digest) hexdump

Class Method Detail

def self.supported_types #

Returns a tuple of types supported by the linked libmbedcrypto.


[View source]

Instance Method Detail

def base64digest! #

Hash the buffer and return the Base64 encoded representation of the digest without allocating a new instance.

NOTE The Digest instance is reset after use.


[View source]
abstract def clone : Digest #

Create an instance of the Digest object with it's internal state copied from this instance.


[View source]
def digest! #

Hash the buffer and return the raw bytes returned by the digest algorithm without allocating a new instance.

NOTE The Digest instance is reset after use.


[View source]
abstract def digest_size : UInt8 #

The length of the digest message this algorithm produces, in bytes.


[View source]
def finalize #

Handles the cleanup of the mbed TLS library handles associated with this Digest instance.


[View source]
def hexdigest! #

Hash the buffer and return the hexadecimal representation of the digest without allocating a new instance.

NOTE The Digest instance is reset after use.


[View source]
def md_type_of : Type #

The Type enum of this Digest algorithm.


[View source]
def name : String #

The readable name of this Digest algorithm.


[View source]
def reset #

Clear the buffer and reset the internal state of the digest context.


[View source]
def to_unsafe : Pointer(LibMbedCrypto::MDContext) #

Returns a pointer to the internal context used by the library.


[View source]
def update(data : String | Slice) #

Add data to the buffer for hashing.

NOTE This method is an implementation detail. Use the more user friendly DigestBase.<< to hash data, or the DigestBase.file method to hash files.


[View source]