getCombinedNonce example

# if (outlen_p != NULL) {         # *outlen_p = 0U;         # }         # if (mlen > crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX) {         # sodium_misuse();         # }
        # crypto_stream_chacha20_ietf(block, sizeof block, state->nonce, state->k);         # crypto_onetimeauth_poly1305_init(&poly1305_state, block);         # sodium_memzero(block, sizeof block);         $auth = new ParagonIE_Sodium_Core_Poly1305_State(
            ParagonIE_Sodium_Core_ChaCha20::ietfStream(32, $st->getCombinedNonce()$st->getKey())
        );

        # crypto_onetimeauth_poly1305_update(&poly1305_state, ad, adlen);         $auth->update($aad);

        # crypto_onetimeauth_poly1305_update(&poly1305_state, _pad0,         # (0x10 - adlen) & 0xf);         $auth->update(str_repeat("\0", ((0x10 - $aadlen) & 0xf)));

        # memset(block, 0, sizeof block);         # block[0] = tag;
# if (outlen_p != NULL) {         # *outlen_p = 0U;         # }         # if (mlen > crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX) {         # sodium_misuse();         # }
        # crypto_stream_chacha20_ietf(block, sizeof block, state->nonce, state->k);         # crypto_onetimeauth_poly1305_init(&poly1305_state, block);         # sodium_memzero(block, sizeof block);         $auth = new ParagonIE_Sodium_Core32_Poly1305_State(
            ParagonIE_Sodium_Core32_ChaCha20::ietfStream(32, $st->getCombinedNonce()$st->getKey())
        );

        # crypto_onetimeauth_poly1305_update(&poly1305_state, ad, adlen);         $auth->update($aad);

        # crypto_onetimeauth_poly1305_update(&poly1305_state, _pad0,         # (0x10 - adlen) & 0xf);         $auth->update(str_repeat("\0", ((0x10 - $aadlen) & 0xf)));

        # memset(block, 0, sizeof block);         # block[0] = tag;
Home | Imprint | This part of the site doesn't use cookies.