Lines Matching full:sha512
2 * sha512.c --- The sha512 algorithm
112 struct sha512_state sha512; member
122 S[i] = md->sha512.state[i]; in sha512_compress()
149 md->sha512.state[i] = md->sha512.state[i] + S[i]; in sha512_compress()
155 md->sha512.curlen = 0; in sha512_init()
156 md->sha512.length = 0; in sha512_init()
157 md->sha512.state[0] = CONST64(0x6a09e667f3bcc908); in sha512_init()
158 md->sha512.state[1] = CONST64(0xbb67ae8584caa73b); in sha512_init()
159 md->sha512.state[2] = CONST64(0x3c6ef372fe94f82b); in sha512_init()
160 md->sha512.state[3] = CONST64(0xa54ff53a5f1d36f1); in sha512_init()
161 md->sha512.state[4] = CONST64(0x510e527fade682d1); in sha512_init()
162 md->sha512.state[5] = CONST64(0x9b05688c2b3e6c1f); in sha512_init()
163 md->sha512.state[6] = CONST64(0x1f83d9abfb41bd6b); in sha512_init()
164 md->sha512.state[7] = CONST64(0x5be0cd19137e2179); in sha512_init()
172 md->sha512.length += md->sha512.curlen * CONST64(8); in sha512_done()
175 md->sha512.buf[md->sha512.curlen++] = (unsigned char)0x80; in sha512_done()
180 if (md->sha512.curlen > 112) { in sha512_done()
181 while (md->sha512.curlen < 128) { in sha512_done()
182 md->sha512.buf[md->sha512.curlen++] = (unsigned char)0; in sha512_done()
184 sha512_compress(md, md->sha512.buf); in sha512_done()
185 md->sha512.curlen = 0; in sha512_done()
190 while (md->sha512.curlen < 120) { in sha512_done()
191 md->sha512.buf[md->sha512.curlen++] = (unsigned char)0; in sha512_done()
195 STORE64H(md->sha512.length, md->sha512.buf + 120); in sha512_done()
196 sha512_compress(md, md->sha512.buf); in sha512_done()
200 STORE64H(md->sha512.state[i], out+(8 * i)); in sha512_done()
213 if (md->sha512.curlen == 0 && inlen >= SHA512_BLOCKSIZE) { in sha512_process()
215 md->sha512.length += SHA512_BLOCKSIZE * 8; in sha512_process()
219 n = MIN(inlen, (SHA512_BLOCKSIZE - md->sha512.curlen)); in sha512_process()
220 memcpy(md->sha512.buf + md->sha512.curlen, in sha512_process()
222 md->sha512.curlen += n; in sha512_process()
225 if (md->sha512.curlen == SHA512_BLOCKSIZE) { in sha512_process()
226 sha512_compress(md, md->sha512.buf); in sha512_process()
227 md->sha512.length += SHA512_BLOCKSIZE * 8; in sha512_process()
228 md->sha512.curlen = 0; in sha512_process()
292 printf("SHA512 test message %d: ", i); in main()