1 // 2 // Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> 3 // Copyright 2018 Capitar IT Group BV <info@capitar.com> 4 // 5 // This software is supplied under the terms of the MIT License, a 6 // copy of which should be located in the distribution where this 7 // file was obtained (LICENSE.txt). A copy of the license may also be 8 // found online at https://opensource.org/licenses/MIT. 9 // 10 11 #ifndef NNG_SUPPLEMENTAL_SHA1_SHA1_H 12 #define NNG_SUPPLEMENTAL_SHA1_SHA1_H 13 14 typedef struct { 15 uint32_t digest[5]; // resulting digest 16 uint64_t len; // length in bits 17 uint8_t blk[64]; // message block 18 int idx; // index of next byte in block 19 } nni_sha1_ctx; 20 21 extern void nni_sha1_init(nni_sha1_ctx *); 22 extern void nni_sha1_update(nni_sha1_ctx *, const void *, size_t); 23 extern void nni_sha1_final(nni_sha1_ctx *, uint8_t[20]); 24 extern void nni_sha1(const void *, size_t, uint8_t[20]); 25 26 #endif // NNG_SUPPLEMENTAL_SHA1_SHA1_H 27