aruu

[MIRROR] Actual replacement for Busybox | suckless
git clone https://git.daat.foo/aruu.git
Log | Files | Refs | README | LICENSE

sha1.h (641B)


      1 /* public domain sha1 implementation based on rfc3174 and libtomcrypt */
      2 
      3 #include <stdint.h>
      4 struct sha1 {
      5   uint64_t len;     /* processed message length */
      6   uint32_t h[5];    /* hash state */
      7   uint8_t  buf[64]; /* message block buffer */
      8 };
      9 
     10 enum { SHA1_DIGEST_LENGTH = 20 };
     11 
     12 /* reset state */
     13 void sha1_init(void *ctx);
     14 /* process message */
     15 void sha1_update(void *ctx, const void *m, unsigned long len);
     16 /* get message digest */
     17 /* state is ruined after sum, keep a copy if multiple sum is needed */
     18 /* part of the message might be left in s, zero it if secrecy is needed */
     19 void sha1_sum(void *ctx, uint8_t md[SHA1_DIGEST_LENGTH]);