SSS - S3 Toolkit 0.9.6
S3 client library and applications
Loading...
Searching...
No Matches
Hash_Utility

Utility function called from hashing functions. More...

Functions

uint64_t to_big_endian (uint64_t n)
 Convert number from little endian to big endian.
 
uint32_t to_little_endian (uint32_t n)
 Convert from big endian to little endian.
 
uint64_t next_div_by (uint64_t n, uint64_t d)
 Return next number evenly divisible by specified number.
 
uint32_t right_rotate (uint32_t x, uint32_t n)
 Right rotate bits of 32 bit integer numbers.
 
uint32_t left_rotate (uint32_t x, uint32_t n)
 Left rotate bits of 32 bit integer numbers.
 
uint32_t lshift (uint8_t n, uint8_t nshifts)
 Left shift of unsigned 8 bit int and conversion to 32 bit.
 
uint8_t * alloc_padded (uint64_t size, uint64_t buffer_size, size_t *sz, uint8_t *tmpbuf)
 Allocate buffer of correct size for computing hash code.
 

Detailed Description

Utility function called from hashing functions.

Function Documentation

◆ alloc_padded()

uint8_t * alloc_padded ( uint64_t  size,
uint64_t  buffer_size,
size_t *  sz,
uint8_t *  tmpbuf 
)

Allocate buffer of correct size for computing hash code.

The input buffer needs to be padded with a 1 bit and 8 bytes containing the buffer size in big endian format. The total size of the buffer size must therefore be greater or equal to:

buffer size + 1 (1...) + 8 (length) = buffer size + 9 bytes

References next_div_by(), and to_big_endian().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ left_rotate()

uint32_t left_rotate ( uint32_t  x,
uint32_t  n 
)
inline

Left rotate bits of 32 bit integer numbers.

Parameters
[in]xnumber to rotate.
[in]nnumber of bitshifts.

◆ lshift()

uint32_t lshift ( uint8_t  n,
uint8_t  nshifts 
)
inline

Left shift of unsigned 8 bit int and conversion to 32 bit.

Parameters
[in]nnumber to shift.
[in]nshiftsnumber of shifts.
Returns
left shifted 32 bit number.
+ Here is the caller graph for this function:

◆ next_div_by()

uint64_t next_div_by ( uint64_t  n,
uint64_t  d 
)
inline

Return next number evenly divisible by specified number.

Parameters
[in]ninput number.
[in]ddivisor
Returns
number evenly divisible by d.
+ Here is the caller graph for this function:

◆ right_rotate()

uint32_t right_rotate ( uint32_t  x,
uint32_t  n 
)
inline

Right rotate bits of 32 bit integer numbers.

Parameters
[in]xnumber to rotate.
[in]nnumber of right shifts.
Returns
right rotated number.
+ Here is the caller graph for this function:

◆ to_big_endian()

uint64_t to_big_endian ( uint64_t  n)
inline

Convert number from little endian to big endian.

Parameters
[in]nnumber to convert in little endian format.
Returns
number in big endian format.
+ Here is the caller graph for this function:

◆ to_little_endian()

uint32_t to_little_endian ( uint32_t  n)
inline

Convert from big endian to little endian.

Parameters
[in]nnumber in big endian format.
Returns
number in little endian format.
+ Here is the caller graph for this function: