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

Function blake2b

freebsd/contrib/libb2/blake2b.c:410–436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

408
409
410int blake2b( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen )
411{
412 blake2b_state S[1];
413
414 /* Verify parameters */
415 if ( NULL == in && inlen > 0 ) return -1;
416
417 if ( NULL == out ) return -1;
418
419 if( NULL == key && keylen > 0 ) return -1;
420
421 if( !outlen || outlen > BLAKE2B_OUTBYTES ) return -1;
422
423 if( keylen > BLAKE2B_KEYBYTES ) return -1;
424
425 if( keylen )
426 {
427 if( blake2b_init_key( S, outlen, key, keylen ) < 0 ) return -1;
428 }
429 else
430 {
431 if( blake2b_init( S, outlen ) < 0 ) return -1;
432 }
433
434 if( blake2b_update( S, ( uint8_t * )in, inlen ) < 0) return -1;
435 return blake2b_final( S, out, outlen );
436}
437
438#if defined(SUPERCOP)
439int crypto_hash( unsigned char *out, unsigned char *in, unsigned long long inlen )

Callers 2

blake2Function · 0.70
crypto_hashFunction · 0.70

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