Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/sodium/crypto_hash_sha256.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #ifndef crypto_hash_sha256_H
0002 #define crypto_hash_sha256_H
0003 
0004 /*
0005  * WARNING: Unless you absolutely need to use SHA256 for interoperability,
0006  * purposes, you might want to consider crypto_generichash() instead.
0007  * Unlike SHA256, crypto_generichash() is not vulnerable to length
0008  * extension attacks.
0009  */
0010 
0011 #include <stddef.h>
0012 #include <stdint.h>
0013 #include <stdlib.h>
0014 
0015 #include "export.h"
0016 
0017 #ifdef __cplusplus
0018 # ifdef __GNUC__
0019 #  pragma GCC diagnostic ignored "-Wlong-long"
0020 # endif
0021 extern "C" {
0022 #endif
0023 
0024 typedef struct crypto_hash_sha256_state {
0025     uint32_t state[8];
0026     uint64_t count;
0027     uint8_t  buf[64];
0028 } crypto_hash_sha256_state;
0029 
0030 SODIUM_EXPORT
0031 size_t crypto_hash_sha256_statebytes(void);
0032 
0033 #define crypto_hash_sha256_BYTES 32U
0034 SODIUM_EXPORT
0035 size_t crypto_hash_sha256_bytes(void);
0036 
0037 SODIUM_EXPORT
0038 int crypto_hash_sha256(unsigned char *out, const unsigned char *in,
0039                        unsigned long long inlen) __attribute__ ((nonnull(1)));
0040 
0041 SODIUM_EXPORT
0042 int crypto_hash_sha256_init(crypto_hash_sha256_state *state)
0043             __attribute__ ((nonnull));
0044 
0045 SODIUM_EXPORT
0046 int crypto_hash_sha256_update(crypto_hash_sha256_state *state,
0047                               const unsigned char *in,
0048                               unsigned long long inlen)
0049             __attribute__ ((nonnull(1)));
0050 
0051 SODIUM_EXPORT
0052 int crypto_hash_sha256_final(crypto_hash_sha256_state *state,
0053                              unsigned char *out)
0054             __attribute__ ((nonnull));
0055 
0056 #ifdef __cplusplus
0057 }
0058 #endif
0059 
0060 #endif