MCPcopy Create free account
hub / github.com/F-Stack/f-stack / blake2b

Function blake2b

freebsd/contrib/libb2/blake2b-ref.c:358–384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356}
357
358int blake2b( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen )
359{
360 blake2b_state S[1];
361
362 /* Verify parameters */
363 if ( NULL == in && inlen > 0 ) return -1;
364
365 if ( NULL == out ) return -1;
366
367 if( NULL == key && keylen > 0 ) return -1;
368
369 if( !outlen || outlen > BLAKE2B_OUTBYTES ) return -1;
370
371 if( keylen > BLAKE2B_KEYBYTES ) return -1;
372
373 if( keylen > 0 )
374 {
375 if( blake2b_init_key( S, outlen, key, keylen ) < 0 ) return -1;
376 }
377 else
378 {
379 if( blake2b_init( S, outlen ) < 0 ) return -1;
380 }
381
382 if( blake2b_update( S, ( uint8_t * )in, inlen ) < 0 ) return -1;
383 return blake2b_final( S, out, outlen );
384}
385
386

Callers

nothing calls this directly

Calls 4

blake2b_init_keyFunction · 0.70
blake2b_initFunction · 0.70
blake2b_updateFunction · 0.70
blake2b_finalFunction · 0.70

Tested by

no test coverage detected