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

Function blake2s

freebsd/contrib/libb2/blake2s.c:388–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

386}
387
388int blake2s( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen )
389{
390 blake2s_state S[1];
391
392 /* Verify parameters */
393 if ( NULL == in && inlen > 0 ) return -1;
394
395 if ( NULL == out ) return -1;
396
397 if ( NULL == key && keylen > 0) return -1;
398
399 if( !outlen || outlen > BLAKE2S_OUTBYTES ) return -1;
400
401 if( keylen > BLAKE2S_KEYBYTES ) return -1;
402
403 if( keylen > 0 )
404 {
405 if( blake2s_init_key( S, outlen, key, keylen ) < 0 ) return -1;
406 }
407 else
408 {
409 if( blake2s_init( S, outlen ) < 0 ) return -1;
410 }
411
412 if( blake2s_update( S, ( uint8_t * )in, inlen ) < 0) return -1;
413 return blake2s_final( S, out, outlen );
414}
415
416#if defined(SUPERCOP)
417int crypto_hash( unsigned char *out, unsigned char *in, unsigned long long inlen )

Callers 1

crypto_hashFunction · 0.70

Calls 4

blake2s_init_keyFunction · 0.70
blake2s_initFunction · 0.70
blake2s_updateFunction · 0.70
blake2s_finalFunction · 0.70

Tested by

no test coverage detected