MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / chacha_split

Function chacha_split

system/lib/mimalloc/src/random.c:111–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111static void chacha_split(mi_random_ctx_t* ctx, uint64_t nonce, mi_random_ctx_t* ctx_new) {
112 _mi_memzero(ctx_new, sizeof(*ctx_new));
113 _mi_memcpy(ctx_new->input, ctx->input, sizeof(ctx_new->input));
114 ctx_new->input[12] = 0;
115 ctx_new->input[13] = 0;
116 ctx_new->input[14] = (uint32_t)nonce;
117 ctx_new->input[15] = (uint32_t)(nonce >> 32);
118 mi_assert_internal(ctx->input[14] != ctx_new->input[14] || ctx->input[15] != ctx_new->input[15]); // do not reuse nonces!
119 chacha_block(ctx_new);
120}
121
122
123/* ----------------------------------------------------------------------------

Callers 1

_mi_random_splitFunction · 0.85

Calls 3

_mi_memzeroFunction · 0.85
_mi_memcpyFunction · 0.85
chacha_blockFunction · 0.85

Tested by

no test coverage detected