MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / blake2s_final

Function blake2s_final

Libraries/unrar/blake2s.cpp:165–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163
164
165void blake2s_final( blake2s_state *S, byte *digest )
166{
167 if( S->buflen > BLAKE2S_BLOCKBYTES )
168 {
169 blake2s_increment_counter( S, BLAKE2S_BLOCKBYTES );
170 blake2s_compress( S, S->buf );
171 S->buflen -= BLAKE2S_BLOCKBYTES;
172 memcpy( S->buf, S->buf + BLAKE2S_BLOCKBYTES, S->buflen );
173 }
174
175 blake2s_increment_counter( S, ( uint32 )S->buflen );
176 blake2s_set_lastblock( S );
177 memset( S->buf + S->buflen, 0, 2 * BLAKE2S_BLOCKBYTES - S->buflen ); /* Padding */
178 blake2s_compress( S, S->buf );
179
180 for( int i = 0; i < 8; ++i ) /* Output full hash */
181 RawPut4( S->h[i], digest + 4 * i );
182}
183

Callers 1

blake2sp_finalFunction · 0.85

Calls 4

blake2s_compressFunction · 0.85
blake2s_set_lastblockFunction · 0.85
RawPut4Function · 0.85

Tested by

no test coverage detected