Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Sodium Compat Laravel Package

paragonie/sodium_compat

Pure-PHP polyfill for PHP’s Sodium (libsodium) cryptography API. Transparently uses the native sodium extension when available; otherwise falls back to a compatible implementation. v1 supports PHP 5.2+ incl. 32-bit; v2 targets PHP 8.1+ only.

View on GitHub
Deep Wiki
Context7
v2.5.0

Security Fix

Read: A vulnerability in libsodium

This fixes a congruent issue in the main branch of the PHP implementation.

For older PHP versions, see v1.24.0 instead.

v1.24.0

Security Fix

Read: A vulnerability in libsodium

This fixes a congruent issue in the v1.x branch of the PHP implementation.

v2.4.0

The biggest change (besides unit testing) in this release is the optimization of Curve25519 field arithmetic by using object properties instead of an internal array. This skips some internal overhead in PHP (i.e., hash tables and memory allocation) that we ultimately never needed.

Beyond that, we mostly expanded our unit test coverage. We're running Infection to identify code that can be mutated without the test suite failing, and it's identified a lot of false positives but also some useful information. The end result? We've fixed a few bugs.

What's Changed

New Contributors

Full Changelog: https://github.com/paragonie/sodium_compat/compare/v2.3.1...v2.4.0

v1.23.0

We backported some optimizations from #198 by replacing the array in the Curve25519 field element with 10 integer object properties instead. The result is a 7% to 12% speedup for the overall PHPUnit suite.

What's Changed

Full Changelog: https://github.com/paragonie/sodium_compat/compare/v1.22.0...v1.23.0

v2.3.1

Deletes the erroneous PSR-0 autoloader declaration from composer.json, fixing #196

Full Changelog: https://github.com/paragonie/sodium_compat/compare/v2.3.0...v2.3.1

v2.3.0

[!IMPORTANT] The previous version of sodium_compat was overly permissible with sodium_base642bin() when the *_NO_PADDING variants were specified, which was not compatible with ext-sodium. This has been fixed in v2.3.0.

If you need the old behavior in the meantime, you can call ParagonIE_Core_Base64_Original::decode() or ParagonIE_Core_Base64_UrlSafe:decode() to get lax padding enabled.

Aside from this fix, most of the changes were to the unit test suite in order to improve our mutation testing metrics.

What's Changed

New Contributors

Full Changelog: https://github.com/paragonie/sodium_compat/compare/v2.2.0...v2.3.0

v1.22.0

[!IMPORTANT] The previous version of sodium_compat was overly permissible with sodium_base642bin() when the *_NO_PADDING variants were specified, which was not compatible with ext-sodium. This has been fixed in v1.22.0.

If you need the old behavior in the meantime, you can call ParagonIE_Core_Base64_Original::decode() or ParagonIE_Core_Base64_UrlSafe:decode() to get lax padding enabled.

What's Changed

Full Changelog: https://github.com/paragonie/sodium_compat/compare/v1.21.2...v1.22.0

v2.2.0

Version 2.2.0 of Sodium_Compat is mostly a maintenance release. Some dev-dependencies were changed in order to facilitate mutation and fuzz testing in CI. No significant changes to the src directory were required as a result of this additional testing.

What's Changed

New Contributors

Full Changelog: https://github.com/paragonie/sodium_compat/compare/v2.1.0...v2.2.0

v2.1.0

What's Changed

New Contributors

Full Changelog: https://github.com/paragonie/sodium_compat/compare/v2.0.1...v2.1.0

v2.0.1

Read this blog post for context.

We pulled v2.0.0 to prevent v2.x from being installed on 32-bit systems.

What's Changed

New Contributors

Full Changelog: https://github.com/paragonie/sodium_compat/compare/v2.0.0...v2.0.1

v1.21.0

Important - Please Read

While this is not the final v1.x release, we will be releasing a new major version soon. See the updated major version policy in our readme for specific guidance.

Beyond that, this is a bog standard feature release. It contains no security fixes, but additional features (including the AEGIS AEAD mode used by libsodium, expected to land in PHP 8.4).

What's Changed

Full Changelog: https://github.com/paragonie/sodium_compat/compare/v1.20.1...v1.21.0

v1.20.1

What's Changed

Full Changelog: https://github.com/paragonie/sodium_compat/compare/v1.20.0...v1.20.1

v1.20.0

What's Changed

  • #157 - Update Wycheproof tests, fix Poly1305 implementation in response to Wycheproof failure

Full Changelog: https://github.com/paragonie/sodium_compat/compare/v1.19.0...v1.20.0

Poly1305 bug?

If you had a specific bit pattern in your Poly1305 key and ciphertext, you would generate an invalid authentication tag. This was caught by the ChaCha20-Poly1305 tests included in Project Wycheproof.

We don't believe this is a security issue because:

  1. Letting attackers control the key going into Poly1305 would defeat the security of this algorithm.
  2. Years of integration and compatibility testing with ext/sodium never encountered the conditions necessary to trigger the bug. (Specifically, a ciphertext of all bits set was one of the conditions necessary to trigger it.)
  3. The impact of triggering the bug is an incorrect authentication tag.

Additionally, if you turned fast multiplication on, you would have not triggered the bug at all.

This slows down our Poly1305 implementation slightly.

v1.19.0
  • Breaking Changes for PHP 8: #152 - We fixed the parameter names for the public API for sodium_compat to conform to the Sodium extension
    • If you weren't relying on the Named Parameters feature (which landed after sodium_compat was created), this doesn't affect you at all.
  • Added missing $ignore parameter to sodium_hex2bin() polyfill
    • Apparently we took that parameter at face value. Mea culpa.
  • More unit testing
v1.18.1
  • Fix #151 (PR #150): Resolve autoload-fast.php include path issue with Wordfence plugin for WordPress
v1.18.0
  • Fixed issues with the PHP autoloader
    • #145: For WordPress, this ensures when Ed25519 is included, so too is the class it inherits from.
    • #148, #149: For PHP 7.4+ with opcache preloading, this ensures the include guards don't fail.
  • #144: Added sodium_crypto_stream_xchacha20_xor_ic()
v1.17.1
  • #140 Fix issues with 32-bit integers and floats on PHP 8.1
  • Curve25519 field elements will now be normalized (overflow bits cleared unless numbers are negative) to prevent this float/int weirdness on PHP 8.1. This adds a very small performance hit on Curve25519 operations, but adds a guardrail against incorrect results.
v1.17.0
  • Fixes several bugs with sodium_crypto_scalarmult_ristretto255() that was producing incorrect results in PHP 8.1
    • Off-by-one error in ge_scalarmult()
    • Multiplication optimizations led to incorrect results for some inputs
  • CI now runs against PHP 8.1
v1.16.1
  • Fixes #122 (undefined constant errors caused by autoloader race conditions)
v1.16.0

Special thanks to Tony Arcieri, Frank Denis, Isis Lovecruft, Mike Hamburg, and Henry de Valence for making this release possible.

v1.15.4
  • Prevent infinite loop with crypto_kx()
  • We're migrated from Github Actions to Travis CI now!
v1.15.3
  • Complete fix for #125.
v1.15.2
  • Always define the new polyfill functions even if PHP >= 7.2 and [an old version of] ext/sodium is used.
v1.15.1
  • Correct polyfill sodium_crypto_stream_xchacha20_xor
v1.15.0
  • Fixes #125
  • Adds sodium_crypto_stream_xchacha20
    • This exposes XChaCha20 with 64-bit ChaCha20 nonces and 64-bit ChaCha20 internal counters. This is in stark contrast to the IETF's 96-bit nonces (with leading NUL bytes) and 32-bit counters, as exposed in the AEAD interface. This is a subtle but important property.
v1.14.0
  • #119 - Side-step mbstring issues on newer PHP
  • #120 - Support PHPUnit 9
  • #121 - Use more inclusive language
  • Improved PHP 8 support
v1.13.0
  • Fix #113 and #116 via #117 - Should fix preloading issues with PHP 7.4+
v1.12.2
  • Fixes #106
  • Fixes #112
  • Possible fix for #113
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport