GNUnet 0.22.2
crypto_hash.c File Reference

SHA-512 GNUNET_CRYPTO_hash() related functions. More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "benchmark.h"
#include <gcrypt.h>
Include dependency graph for crypto_hash.c:

Go to the source code of this file.

Data Structures

struct  GNUNET_HashContext
 

Macros

#define LOG(kind, ...)   GNUNET_log_from (kind, "util-crypto-hash", __VA_ARGS__)
 
#define LOG_STRERROR_FILE(kind, syscall, filename)
 

Functions

void GNUNET_CRYPTO_hash (const void *block, size_t size, struct GNUNET_HashCode *ret)
 Compute hash of a given block. More...
 
void GNUNET_CRYPTO_hash_to_enc (const struct GNUNET_HashCode *block, struct GNUNET_CRYPTO_HashAsciiEncoded *result)
 Convert hash to ASCII encoding. More...
 
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hash_from_string2 (const char *enc, size_t enclen, struct GNUNET_HashCode *result)
 Convert ASCII encoding back to a 'struct GNUNET_HashCode'. More...
 
unsigned int GNUNET_CRYPTO_hash_distance_u32 (const struct GNUNET_HashCode *a, const struct GNUNET_HashCode *b)
 Compute the distance between 2 hashcodes. More...
 
void GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode, struct GNUNET_HashCode *result)
 Create a random hash code. More...
 
void GNUNET_CRYPTO_hash_difference (const struct GNUNET_HashCode *a, const struct GNUNET_HashCode *b, struct GNUNET_HashCode *result)
 compute result = b - a More...
 
void GNUNET_CRYPTO_hash_sum (const struct GNUNET_HashCode *a, const struct GNUNET_HashCode *delta, struct GNUNET_HashCode *result)
 compute result = a + delta More...
 
void GNUNET_CRYPTO_hash_xor (const struct GNUNET_HashCode *a, const struct GNUNET_HashCode *b, struct GNUNET_HashCode *result)
 compute result = a ^ b More...
 
void GNUNET_CRYPTO_hash_to_aes_key (const struct GNUNET_HashCode *hc, struct GNUNET_CRYPTO_SymmetricSessionKey *skey, struct GNUNET_CRYPTO_SymmetricInitializationVector *iv)
 Convert a hashcode into a key. More...
 
unsigned int GNUNET_CRYPTO_hash_count_leading_zeros (const struct GNUNET_HashCode *h)
 Count the number of leading 0 bits in h. More...
 
unsigned int GNUNET_CRYPTO_hash_count_tailing_zeros (const struct GNUNET_HashCode *h)
 Count the number of tailing 0 bits in h. More...
 
int GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode *h1, const struct GNUNET_HashCode *h2)
 Compare function for HashCodes, producing a total ordering of all hashcodes. More...
 
int GNUNET_CRYPTO_hash_xorcmp (const struct GNUNET_HashCode *h1, const struct GNUNET_HashCode *h2, const struct GNUNET_HashCode *target)
 Find out which of the two GNUNET_CRYPTO_hash codes is closer to target in the XOR metric (Kademlia). More...
 
void GNUNET_CRYPTO_hmac_derive_key (struct GNUNET_CRYPTO_AuthKey *key, const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey, const void *salt, size_t salt_len,...)
 Derive an authentication key. More...
 
void GNUNET_CRYPTO_hmac_derive_key_v (struct GNUNET_CRYPTO_AuthKey *key, const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey, const void *salt, size_t salt_len, va_list argp)
 Derive an authentication key. More...
 
void GNUNET_CRYPTO_hmac_raw (const void *key, size_t key_len, const void *plaintext, size_t plaintext_len, struct GNUNET_HashCode *hmac)
 Calculate HMAC of a message (RFC 2104) TODO: Shouldn't this be the standard hmac function and the above be renamed? More...
 
void GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key, const void *plaintext, size_t plaintext_len, struct GNUNET_HashCode *hmac)
 Calculate HMAC of a message (RFC 2104) More...
 
struct GNUNET_HashContextGNUNET_CRYPTO_hash_context_start ()
 Start incremental hashing operation. More...
 
void GNUNET_CRYPTO_hash_context_read (struct GNUNET_HashContext *hc, const void *buf, size_t size)
 Add data to be hashed. More...
 
struct GNUNET_HashContextGNUNET_CRYPTO_hash_context_copy (const struct GNUNET_HashContext *hc)
 Make a copy of the hash computation. More...
 
void GNUNET_CRYPTO_hash_context_finish (struct GNUNET_HashContext *hc, struct GNUNET_HashCode *r_hash)
 Finish the hash computation. More...
 
void GNUNET_CRYPTO_hash_context_abort (struct GNUNET_HashContext *hc)
 Abort hashing, do not bother calculating final result. More...
 

Detailed Description

SHA-512 GNUNET_CRYPTO_hash() related functions.

Author
Christian Grothoff

Definition in file crypto_hash.c.

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log_from (kind, "util-crypto-hash", __VA_ARGS__)

Definition at line 32 of file crypto_hash.c.

◆ LOG_STRERROR_FILE

#define LOG_STRERROR_FILE (   kind,
  syscall,
  filename 
)
Value:
"util-crypto-hash", \
syscall, \
static char * filename
#define GNUNET_log_from_strerror_file(level, component, cmd, filename)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...

Definition at line 34 of file crypto_hash.c.