Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

sph_types.h File Reference

Basic type definitions. More...

#include <limits.h>
+ Include dependency graph for sph_types.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SPH_C32(x)   ((sph_u32)(x ## UL))
 
#define SPH_T32(x)   ((x) & SPH_C32(0xFFFFFFFF))
 
#define SPH_ROTL32(x, n)   SPH_T32(((x) << (n)) | ((x) >> (32 - (n))))
 
#define SPH_ROTR32(x, n)   SPH_ROTL32(x, (32 - (n)))
 
#define SPH_INLINE
 

Typedefs

typedef unsigned long sph_u32
 
typedef long sph_s32
 

Functions

static SPH_INLINE sph_u32 sph_bswap32 (sph_u32 x)
 
static SPH_INLINE void sph_enc16be (void *dst, unsigned val)
 
static SPH_INLINE unsigned sph_dec16be (const void *src)
 
static SPH_INLINE void sph_enc16le (void *dst, unsigned val)
 
static SPH_INLINE unsigned sph_dec16le (const void *src)
 
static SPH_INLINE void sph_enc32be (void *dst, sph_u32 val)
 Encode a 32-bit value into the provided buffer (big endian convention). More...
 
static SPH_INLINE void sph_enc32be_aligned (void *dst, sph_u32 val)
 Encode a 32-bit value into the provided buffer (big endian convention). More...
 
static SPH_INLINE sph_u32 sph_dec32be (const void *src)
 Decode a 32-bit value from the provided buffer (big endian convention). More...
 
static SPH_INLINE sph_u32 sph_dec32be_aligned (const void *src)
 Decode a 32-bit value from the provided buffer (big endian convention). More...
 
static SPH_INLINE void sph_enc32le (void *dst, sph_u32 val)
 Encode a 32-bit value into the provided buffer (little endian convention). More...
 
static SPH_INLINE void sph_enc32le_aligned (void *dst, sph_u32 val)
 Encode a 32-bit value into the provided buffer (little endian convention). More...
 
static SPH_INLINE sph_u32 sph_dec32le (const void *src)
 Decode a 32-bit value from the provided buffer (little endian convention). More...
 
static SPH_INLINE sph_u32 sph_dec32le_aligned (const void *src)
 Decode a 32-bit value from the provided buffer (little endian convention). More...
 

Detailed Description

Basic type definitions.

This header file defines the generic integer types that will be used for the implementation of hash functions; it also contains helper functions which encode and decode multi-byte integer values, using either little-endian or big-endian conventions.

This file contains a compile-time test on the size of a byte (the unsigned char C type). If bytes are not octets, i.e. if they do not have a size of exactly 8 bits, then compilation is aborted. Architectures where bytes are not octets are relatively rare, even in the embedded devices market. We forbid non-octet bytes because there is no clear convention on how octet streams are encoded on such systems.

==========================(LICENSE BEGIN)============================

Copyright (c) 2007-2010 Projet RNRT SAPHIR

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

===========================(LICENSE END)=============================

Author
Thomas Pornin thoma.nosp@m.s.po.nosp@m.rnin@.nosp@m.cryp.nosp@m.tolog.nosp@m..com

Definition in file sph_types.h.

Macro Definition Documentation

◆ SPH_C32

#define SPH_C32 (   x)    ((sph_u32)(x ## UL))

Definition at line 873 of file sph_types.h.

Referenced by blake32_close(), cubehash_close(), keccak_init(), and sph_bswap32().

◆ SPH_INLINE

#define SPH_INLINE

Definition at line 954 of file sph_types.h.

◆ SPH_ROTL32

#define SPH_ROTL32 (   x,
 
)    SPH_T32(((x) << (n)) | ((x) >> (32 - (n))))

Definition at line 933 of file sph_types.h.

◆ SPH_ROTR32

#define SPH_ROTR32 (   x,
 
)    SPH_ROTL32(x, (32 - (n)))

Definition at line 934 of file sph_types.h.

◆ SPH_T32

Typedef Documentation

◆ sph_s32

typedef long sph_s32

Definition at line 871 of file sph_types.h.

◆ sph_u32

typedef unsigned long sph_u32

Definition at line 870 of file sph_types.h.

Function Documentation

◆ sph_bswap32()

◆ sph_dec16be()

static SPH_INLINE unsigned sph_dec16be ( const void *  src)
static

Definition at line 1340 of file sph_types.h.

◆ sph_dec16le()

static SPH_INLINE unsigned sph_dec16le ( const void *  src)
static

Definition at line 1354 of file sph_types.h.

◆ sph_dec32be()

static SPH_INLINE sph_u32 sph_dec32be ( const void *  src)
static

Decode a 32-bit value from the provided buffer (big endian convention).

Parameters
srcthe source buffer
Returns
the decoded value

Definition at line 1425 of file sph_types.h.

References sph_bswap32().

◆ sph_dec32be_aligned()

static SPH_INLINE sph_u32 sph_dec32be_aligned ( const void *  src)
static

Decode a 32-bit value from the provided buffer (big endian convention).

The source buffer must be properly aligned.

Parameters
srcthe source buffer (32-bit aligned)
Returns
the decoded value

Definition at line 1464 of file sph_types.h.

References sph_bswap32().

◆ sph_dec32le()

static SPH_INLINE sph_u32 sph_dec32le ( const void *  src)
static

Decode a 32-bit value from the provided buffer (little endian convention).

Parameters
srcthe source buffer
Returns
the decoded value

Definition at line 1543 of file sph_types.h.

References sph_bswap32().

◆ sph_dec32le_aligned()

static SPH_INLINE sph_u32 sph_dec32le_aligned ( const void *  src)
static

Decode a 32-bit value from the provided buffer (little endian convention).

The source buffer must be properly aligned.

Parameters
srcthe source buffer (32-bit aligned)
Returns
the decoded value

Definition at line 1615 of file sph_types.h.

References sph_bswap32().

Referenced by c256(), c512(), compress_big(), and compress_small().

◆ sph_enc16be()

static SPH_INLINE void sph_enc16be ( void *  dst,
unsigned  val 
)
static

Definition at line 1333 of file sph_types.h.

◆ sph_enc16le()

static SPH_INLINE void sph_enc16le ( void *  dst,
unsigned  val 
)
static

Definition at line 1347 of file sph_types.h.

Referenced by echo_big_close(), and echo_small_close().

◆ sph_enc32be()

static SPH_INLINE void sph_enc32be ( void *  dst,
sph_u32  val 
)
static

Encode a 32-bit value into the provided buffer (big endian convention).

Parameters
dstthe destination buffer
valthe 32-bit value to encode

Definition at line 1367 of file sph_types.h.

References sph_bswap32().

Referenced by blake32_close(), jh_close(), luffa3_close(), luffa4_close(), and luffa5_close().

◆ sph_enc32be_aligned()

static SPH_INLINE void sph_enc32be_aligned ( void *  dst,
sph_u32  val 
)
static

Encode a 32-bit value into the provided buffer (big endian convention).

The destination buffer must be properly aligned.

Parameters
dstthe destination buffer (32-bit aligned)
valthe value to encode

Definition at line 1404 of file sph_types.h.

References sph_bswap32().

Referenced by blake32_close().

◆ sph_enc32le()

static SPH_INLINE void sph_enc32le ( void *  dst,
sph_u32  val 
)
static

Encode a 32-bit value into the provided buffer (little endian convention).

Parameters
dstthe destination buffer
valthe 32-bit value to encode

Definition at line 1485 of file sph_types.h.

References sph_bswap32().

Referenced by bmw32_close(), cubehash_close(), encode_count_big(), encode_count_small(), finalize_big(), finalize_small(), shavite_big_close(), and shavite_small_close().

◆ sph_enc32le_aligned()

static SPH_INLINE void sph_enc32le_aligned ( void *  dst,
sph_u32  val 
)
static

Encode a 32-bit value into the provided buffer (little endian convention).

The destination buffer must be properly aligned.

Parameters
dstthe destination buffer (32-bit aligned)
valthe value to encode

Definition at line 1522 of file sph_types.h.

References sph_bswap32().

Referenced by bmw32_close(), echo_big_close(), and echo_small_close().

Released under the MIT license