Git Product home page Git Product logo

Comments (5)

paragonie-security avatar paragonie-security commented on June 20, 2024 1

This is fixed in v1.15.0.

from sodium_compat.

superpoincare avatar superpoincare commented on June 20, 2024

Thanks.

This is not giving an error now but using null doesn't decrypt.

from sodium_compat.

paragonie-security avatar paragonie-security commented on June 20, 2024

Given this code...

<?php

if (!extension_loaded('sodium')) {
    exit;
}
$key = random_bytes(32);
$nonce = random_bytes(24);

$message = 'Pi day was a month ago and I suddenly crave pie.';

$ciphertext = sodium_crypto_aead_xchacha20poly1305_ietf_encrypt($message, '', $nonce, $key);
$c2 = sodium_crypto_aead_xchacha20poly1305_ietf_encrypt($message, NULL, $nonce, $key);

var_dump(
    bin2hex($ciphertext), bin2hex($c2)
);

...I get this output:

string(128) "8e2e220c7c917e7dc65fe2af6af246eb9c1b38be92a1a2ef15cf9bd8cfbe242f46934485e5f94706df06dcb75a88acf79a6e044fb929113c9e56c42899ff677a"
string(128) "8e2e220c7c917e7dc65fe2af6af246eb9c1b38be92a1a2ef15cf9bd8cfbe242f46934485e5f94706df06dcb75a88acf79a6e044fb929113c9e56c42899ff677a"

This tells me that NULL and "" (empty string) are treated the same by ext/sodium. Does that solve the problem for you?

from sodium_compat.

paragonie-security avatar paragonie-security commented on June 20, 2024

Version v1.5.3 contains the complete fix, and has a regression test added to prevent this from ever being reintroduced.

from sodium_compat.

superpoincare avatar superpoincare commented on June 20, 2024

Yeah, I had a decrypt function and that decrypts well now.

Great!

from sodium_compat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.