Sha256: 1781d5ff2e7081e9382045f436f2d2c3a79529f14af037ed1440f25017ae0d36

Contents?: true

Size: 641 Bytes

Versions: 8

Compression:

Stored size: 641 Bytes

Contents

int
hydro_kdf_derive_from_key(uint8_t *subkey, size_t subkey_len, uint64_t subkey_id,
                          const char    ctx[hydro_kdf_CONTEXTBYTES],
                          const uint8_t key[hydro_kdf_KEYBYTES])
{
    hydro_hash_state st;

    COMPILER_ASSERT(hydro_kdf_CONTEXTBYTES >= hydro_hash_CONTEXTBYTES);
    COMPILER_ASSERT(hydro_kdf_KEYBYTES >= hydro_hash_KEYBYTES);
    if (hydro_hash_init_with_tweak(&st, ctx, subkey_id, key) != 0) {
        return -1;
    }
    return hydro_hash_final(&st, subkey, subkey_len);
}

void
hydro_kdf_keygen(uint8_t key[hydro_kdf_KEYBYTES])
{
    hydro_random_buf(key, hydro_kdf_KEYBYTES);
}

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
ffi-hydrogen-0.1.5 vendor/libhydrogen/impl/kdf.h
dualcone-1.0.0 vendor/libhydrogen/impl/kdf.h
ffi-hydrogen-0.1.4 vendor/libhydrogen/impl/kdf.h
dualcone-0.0.1 vendor/libhydrogen/impl/kdf.h
ffi-hydrogen-0.1.3 vendor/libhydrogen/impl/kdf.h
ffi-hydrogen-0.1.2 vendor/libhydrogen/impl/kdf.h
ffi-hydrogen-0.1.1 vendor/libhydrogen/impl/kdf.h
ffi-hydrogen-0.1.0 vendor/libhydrogen/impl/kdf.h