File indexing completed on 2025-01-18 10:02:16
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #ifndef NETTLE_SHA3_H_INCLUDED
0035 #define NETTLE_SHA3_H_INCLUDED
0036
0037 #include "nettle-types.h"
0038
0039 #ifdef __cplusplus
0040 extern "C" {
0041 #endif
0042
0043
0044 #define sha3_permute nettle_sha3_permute
0045 #define sha3_224_init nettle_sha3_224_init
0046 #define sha3_224_update nettle_sha3_224_update
0047 #define sha3_224_digest nettle_sha3_224_digest
0048 #define sha3_256_init nettle_sha3_256_init
0049 #define sha3_256_update nettle_sha3_256_update
0050 #define sha3_256_digest nettle_sha3_256_digest
0051 #define sha3_256_shake nettle_sha3_256_shake
0052 #define sha3_384_init nettle_sha3_384_init
0053 #define sha3_384_update nettle_sha3_384_update
0054 #define sha3_384_digest nettle_sha3_384_digest
0055 #define sha3_512_init nettle_sha3_512_init
0056 #define sha3_512_update nettle_sha3_512_update
0057 #define sha3_512_digest nettle_sha3_512_digest
0058
0059
0060 #define NETTLE_SHA3_FIPS202 1
0061
0062
0063
0064
0065
0066 #define SHA3_STATE_LENGTH 25
0067
0068
0069 struct sha3_state
0070 {
0071 uint64_t a[SHA3_STATE_LENGTH];
0072 };
0073
0074 void
0075 sha3_permute (struct sha3_state *state);
0076
0077
0078
0079
0080
0081 #define SHA3_224_DIGEST_SIZE 28
0082 #define SHA3_224_BLOCK_SIZE 144
0083
0084 #define SHA3_256_DIGEST_SIZE 32
0085 #define SHA3_256_BLOCK_SIZE 136
0086
0087 #define SHA3_384_DIGEST_SIZE 48
0088 #define SHA3_384_BLOCK_SIZE 104
0089
0090 #define SHA3_512_DIGEST_SIZE 64
0091 #define SHA3_512_BLOCK_SIZE 72
0092
0093
0094 #define SHA3_224_DATA_SIZE SHA3_224_BLOCK_SIZE
0095 #define SHA3_256_DATA_SIZE SHA3_256_BLOCK_SIZE
0096 #define SHA3_384_DATA_SIZE SHA3_384_BLOCK_SIZE
0097 #define SHA3_512_DATA_SIZE SHA3_512_BLOCK_SIZE
0098
0099 struct sha3_224_ctx
0100 {
0101 struct sha3_state state;
0102 unsigned index;
0103 uint8_t block[SHA3_224_BLOCK_SIZE];
0104 };
0105
0106 void
0107 sha3_224_init (struct sha3_224_ctx *ctx);
0108
0109 void
0110 sha3_224_update (struct sha3_224_ctx *ctx,
0111 size_t length,
0112 const uint8_t *data);
0113
0114 void
0115 sha3_224_digest(struct sha3_224_ctx *ctx,
0116 size_t length,
0117 uint8_t *digest);
0118
0119 struct sha3_256_ctx
0120 {
0121 struct sha3_state state;
0122 unsigned index;
0123 uint8_t block[SHA3_256_BLOCK_SIZE];
0124 };
0125
0126 void
0127 sha3_256_init (struct sha3_256_ctx *ctx);
0128
0129 void
0130 sha3_256_update (struct sha3_256_ctx *ctx,
0131 size_t length,
0132 const uint8_t *data);
0133
0134 void
0135 sha3_256_digest(struct sha3_256_ctx *ctx,
0136 size_t length,
0137 uint8_t *digest);
0138
0139
0140
0141 void
0142 sha3_256_shake(struct sha3_256_ctx *ctx,
0143 size_t length,
0144 uint8_t *digest);
0145
0146 struct sha3_384_ctx
0147 {
0148 struct sha3_state state;
0149 unsigned index;
0150 uint8_t block[SHA3_384_BLOCK_SIZE];
0151 };
0152
0153 void
0154 sha3_384_init (struct sha3_384_ctx *ctx);
0155
0156 void
0157 sha3_384_update (struct sha3_384_ctx *ctx,
0158 size_t length,
0159 const uint8_t *data);
0160
0161 void
0162 sha3_384_digest(struct sha3_384_ctx *ctx,
0163 size_t length,
0164 uint8_t *digest);
0165
0166 struct sha3_512_ctx
0167 {
0168 struct sha3_state state;
0169 unsigned index;
0170 uint8_t block[SHA3_512_BLOCK_SIZE];
0171 };
0172
0173 void
0174 sha3_512_init (struct sha3_512_ctx *ctx);
0175
0176 void
0177 sha3_512_update (struct sha3_512_ctx *ctx,
0178 size_t length,
0179 const uint8_t *data);
0180
0181 void
0182 sha3_512_digest(struct sha3_512_ctx *ctx,
0183 size_t length,
0184 uint8_t *digest);
0185
0186 #ifdef __cplusplus
0187 }
0188 #endif
0189
0190 #endif