PIP 5.6.1
Platform-Independent Primitives
Public Types | Static Public Member Functions | List of all members
PIDigest Class Reference

One-shot digest API for supported algorithms. More...

#include <pidigest.h>

Public Types

enum class  Type {
  SHA1 , SHA2_224 , SHA2_256 , SHA2_384 ,
  SHA2_512 , SHA2_512_224 , SHA2_512_256 , MD2 ,
  MD4 , MD5 , BLAKE2s_128 , BLAKE2s_160 ,
  BLAKE2s_224 , BLAKE2s_256 , BLAKE2b_128 , BLAKE2b_160 ,
  BLAKE2b_224 , BLAKE2b_256 , BLAKE2b_384 , BLAKE2b_512 ,
  SipHash_2_4_64 , SipHash_2_4_128 , HalfSipHash_2_4_32 , HalfSipHash_2_4_64 ,
  Count
}
 Supported digest algorithms. More...
 

Static Public Member Functions

static int hashLength (Type type)
 Returns digest length in bytes for algorithm "type".
 
static int blockLength (Type type)
 Returns internal block length in bytes for algorithm "type".
 
static PIConstChars typeName (Type type)
 Returns stable algorithm name for "type".
 
static PIByteArray calculate (const PIByteArray &msg, Type type)
 Calculates digest of message "msg" with algorithm "type".
 
static PIByteArray calculateWithKey (const PIByteArray &msg, const PIByteArray &key, Type type)
 Calculates keyed digest for algorithms with native key support, otherwise returns empty array.
 
static PIByteArray HMAC (const PIByteArray &msg, const PIByteArray &key, PIDigest::Type type)
 Calculates HMAC for message "msg" and key "key" with algorithm "type".
 

Detailed Description

One-shot digest API for supported algorithms.

Member Enumeration Documentation

◆ Type

enum class PIDigest::Type
strong

Supported digest algorithms.

Enumerator
SHA1 

SHA-1

SHA2_224 

SHA-2 with 224-bit digest

SHA2_256 

SHA-2 with 256-bit digest

SHA2_384 

SHA-2 with 384-bit digest

SHA2_512 

SHA-2 with 512-bit digest

SHA2_512_224 

SHA-512/224

SHA2_512_256 

SHA-512/256

MD2 

MD2

MD4 

MD4

MD5 

MD5

BLAKE2s_128 

BLAKE2s with 128-bit digest

BLAKE2s_160 

BLAKE2s with 160-bit digest

BLAKE2s_224 

BLAKE2s with 224-bit digest

BLAKE2s_256 

BLAKE2s with 256-bit digest

BLAKE2b_128 

BLAKE2b with 128-bit digest

BLAKE2b_160 

BLAKE2b with 160-bit digest

BLAKE2b_224 

BLAKE2b with 224-bit digest

BLAKE2b_256 

BLAKE2b with 256-bit digest

BLAKE2b_384 

BLAKE2b with 384-bit digest

BLAKE2b_512 

BLAKE2b with 512-bit digest

SipHash_2_4_64 

SipHash-2-4 with 64-bit output

SipHash_2_4_128 

SipHash-2-4 with 128-bit output

HalfSipHash_2_4_32 

HalfSipHash-2-4 with 32-bit output

HalfSipHash_2_4_64 

HalfSipHash-2-4 with 64-bit output

Count 

Number of supported algorithms