void sha256_final(sha256_ctx *p) { uint64_t len; p->in[p->inlen++] = 0x80; if(p->inlen > 56) { memset(p->in + p->inlen, 0, 64 - p->inlen); sha256_block(p); } memset(p->in + p->inlen, 0, 56 - p->inlen); len = p->len << 3; ST32BE(p->in + 56, len >> 32); ST32BE(p->in + 60, len); sha256_block(p); }
void sha256_hash(sha256_ctx *p, uint8 *s) { uint32 *t = (uint32*)s; for(uint32 i = 0; i < 8; i++) ST32BE(t++, p->h[i]); }
void sha256_hash(sha256_ctx *p, uint8_t *s) { uint32_t *t = (uint32_t*)s; for(unsigned i = 0; i < 8; i++) ST32BE(t++, p->h[i]); }