verus/verus_hash.h
// chains Haraka256 from 32 bytes to fill the key
chains Haraka256 from 32 bytes to fill the key
chains Haraka256 from 32 bytes to fill the key
static u128 *GenNewCLKey(unsigned char *seedBytes32)
        {
			unsigned char *key = (unsigned char *)verusclhasher_key.get();
            verusclhash_descr *pdesc = (verusclhash_descr *)verusclhasher_descr.get();
            if (pdesc->seed != *((uint256 *)seedBytes32))
            {
                int n256blks = pdesc->keySizeInBytes >> 5;
                int nbytesExtra = pdesc->keySizeInBytes & 0x1f;
                unsigned char *pkey = key + pdesc->keySizeInBytes;
                unsigned char *psrc = seedBytes32;
                for (int i = 0; i < n256blks; i++)
                {
                    (*haraka256Function)(pkey, psrc);
                    psrc = pkey;
                    pkey += 32;
                }
                if (nbytesExtra)
                {
                    unsigned char buf[32];
                    (*haraka256Function)(buf, psrc);
                    memcpy(pkey, buf, nbytesExtra);
                }
                pdesc->seed = *((uint256 *)seedBytes32);
            }
            memcpy(key, key + pdesc->keySizeInBytes, pdesc->keySizeInBytes);
            return (u128 *)key;
        }
static u128 * GenNewCLKey ( unsigned char * seedBytes32 ) { unsigned char * key = ( unsigned char * ) verusclhasher_key . get ( ) ; verusclhash_descr * pdesc = ( verusclhash_descr * ) verusclhasher_descr . get ( ) ; if ( pdesc -> seed != * ( ( uint256 * ) seedBytes32 ) ) { int n256blks = pdesc -> keySizeInBytes >> 5 ; int nbytesExtra = pdesc -> keySizeInBytes & 0x1f ; unsigned char * pkey = key + pdesc -> keySizeInBytes ; unsigned char * psrc = seedBytes32 ; for ( int i = 0 ; i < n256blks ; i ++ ) { ( * haraka256Function ) ( pkey , psrc ) ; psrc = pkey ; pkey += 32 ; } if ( nbytesExtra ) { unsigned char buf [ 32 ] ; ( * haraka256Function ) ( buf , psrc ) ; memcpy ( pkey , buf , nbytesExtra ) ; } pdesc -> seed = * ( ( uint256 * ) seedBytes32 ) ; } memcpy ( key , key + pdesc -> keySizeInBytes , pdesc -> keySizeInBytes ) ; return ( u128 * ) key ; }
chains Haraka256 from 32 bytes to fill the key
chains Haraka256 from 32 bytes to fill the key
// skip keygen if it is the current key // generate a new key by chain hashing with Haraka256 from the last curbuf