xrootd
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Private Member Functions | List of all members
XrdOucSHA3 Class Reference

#include <XrdOucSHA3.hh>

Classes

struct  sha3_ctx_t
 SHA3 state context used by all methods (OpenSSL - like interface) More...
 

Public Types

enum  MDLen {
  SHA3_128 = 16 , SHA3_224 = 28 , SHA3_256 = 32 , SHA3_384 = 48 ,
  SHA3_512 = 64
}
 SHA3 digest lengths (bits to bytes). More...
 

Public Member Functions

 XrdOucSHA3 ()
 
 ~XrdOucSHA3 ()
 

Static Public Member Functions

static void * Calc (const void *in, size_t inlen, void *md, MDLen mdlen)
 
static void Init (sha3_ctx_t *c, MDLen mdlen)
 
static void Update (sha3_ctx_t *c, const void *data, size_t len)
 
static void Final (sha3_ctx_t *c, void *md)
 
static void SHAKE128_Init (sha3_ctx_t *c)
 
static void SHAKE256_Init (sha3_ctx_t *c)
 
static void SHAKE_Update (sha3_ctx_t *c, const void *data, size_t len)
 
static void SHAKE_Out (sha3_ctx_t *c, void *out, size_t len)
 

Static Private Member Functions

static void shake_xof (sha3_ctx_t *c)
 
static void sha3_keccakf (uint64_t st[25])
 

Member Enumeration Documentation

◆ MDLen

SHA3 digest lengths (bits to bytes).

Enumerator
SHA3_128 
SHA3_224 
SHA3_256 
SHA3_384 
SHA3_512 

Constructor & Destructor Documentation

◆ XrdOucSHA3()

XrdOucSHA3::XrdOucSHA3 ( )
inline

◆ ~XrdOucSHA3()

XrdOucSHA3::~XrdOucSHA3 ( )
inline

Member Function Documentation

◆ Calc()

static void * XrdOucSHA3::Calc ( const void *  in,
size_t  inlen,
void *  md,
MDLen  mdlen 
)
static

Compute a sha3 hash (md) of given byte length from "in" (one time call).

Parameters
inPointer to input data.
inlenLength of data in bytes.
mdPointer to mbuffer of size SHA3_xxx to receive result.
mdlenMessage digest byte length (one of the listed enums).
Returns
Pointer to md.

◆ Final()

static void XrdOucSHA3::Final ( sha3_ctx_t c,
void *  md 
)
static

Return final message digest.

Parameters
cPointer to context.
mdPointer to buffer of size SHA3_xxx to receive result.

◆ Init()

static void XrdOucSHA3::Init ( sha3_ctx_t c,
MDLen  mdlen 
)
static

Initialize context in prepration for computing SHA3 checksum.

Parameters
cPointer to context.
mdlenMessage digest byte length (one of the listed enums).

Referenced by SHAKE128_Init(), and SHAKE256_Init().

◆ sha3_keccakf()

static void XrdOucSHA3::sha3_keccakf ( uint64_t  st[25])
staticprivate

◆ SHAKE128_Init()

static void XrdOucSHA3::SHAKE128_Init ( sha3_ctx_t c)
inlinestatic

Initialize context to compute an extensible hash using a SHA3_128 digest.

Parameters
cPointer to context.

References Init(), and SHA3_128.

◆ SHAKE256_Init()

static void XrdOucSHA3::SHAKE256_Init ( sha3_ctx_t c)
inlinestatic

Initialize context to compute an extensible hash using a SHA3_256 digest.

Parameters
cPointer to context.

References Init(), and SHA3_256.

◆ SHAKE_Out()

static void XrdOucSHA3::SHAKE_Out ( sha3_ctx_t c,
void *  out,
size_t  len 
)
static

Return final message digest of desired length. This function may be called iteratively to get as many bits as needed. Bits beyound MDLen form a pseudo-random sequence (i.e. are repeatable with the same input).

Parameters
cPointer to context.
outPointer to buffer of size len to receive result.
lenThe number of digest bytes to return.

◆ SHAKE_Update()

static void XrdOucSHA3::SHAKE_Update ( sha3_ctx_t c,
const void *  data,
size_t  len 
)
inlinestatic

Update shake digest with data.

Parameters
cPointer to context.
dataPointer to data.
lenLength of data in bytes.

References Update().

◆ shake_xof()

static void XrdOucSHA3::shake_xof ( sha3_ctx_t c)
staticprivate

◆ Update()

static void XrdOucSHA3::Update ( sha3_ctx_t c,
const void *  data,
size_t  len 
)
static

Update digest with data.

Parameters
cPointer to context.
dataPointer to data.
lenLength of data in bytes.

Referenced by SHAKE_Update().


The documentation for this class was generated from the following file: