totp

Simple cli tool for storing TOTP secrets and generating tokens
git clone https://git.inz.fi/totp/
Log | Files | Refs | Submodules

sha512.h (798B)


      1 #ifndef SHA512_H
      2 #define SHA512_H
      3 
      4 #include <stdlib.h>
      5 #include <stdint.h>
      6 
      7 #define SHA512_HASHSIZE 64
      8 #define SHA384_HASHSIZE 48
      9 
     10 struct sha512 {
     11 	uint8_t buffer[128];
     12 	uint64_t h[8];
     13 	uint64_t len;
     14 };
     15 
     16 struct sha384 {
     17 	uint8_t buffer[128];
     18 	uint64_t h[6];
     19 	uint64_t h6;
     20 	uint64_t h7;
     21 	uint64_t len;
     22 };
     23 
     24 void sha512_init(struct sha512 *s);
     25 void sha512_update(struct sha512 *s, const void *data, size_t len);
     26 void sha512_finish(struct sha512 *s);
     27 
     28 void sha512_hmac(const void *key, size_t keylen,
     29 		 const void *data, size_t datalen,
     30 		 void *h);
     31 
     32 void sha384_init(struct sha384 *s);
     33 void sha384_update(struct sha384 *s, const void *data, size_t len);
     34 void sha384_finish(struct sha384 *s);
     35 
     36 void sha384_hmac(const void *key, size_t keylen,
     37 		 const void *data, size_t datalen,
     38 		 void *h);
     39 
     40 #endif