diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 4c809f78..c8d1358a 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -1267,7 +1267,7 @@ class SSH2 $identifier = 'SSH-2.0-phpseclib_2.0'; $ext = []; - if (extension_loaded('libsodium')) { + if (function_exists('\\Sodium\\library_version_major')) { $ext[] = 'libsodium'; } diff --git a/tests/Unit/Net/SSH2Test.php b/tests/Unit/Net/SSH2Test.php index e7057b67..b670e496 100644 --- a/tests/Unit/Net/SSH2Test.php +++ b/tests/Unit/Net/SSH2Test.php @@ -41,7 +41,7 @@ class Unit_Net_SSH2Test extends PhpseclibTestCase $identifier = self::callFunc($this->createSSHMock(), 'generate_identifier'); $this->assertStringStartsWith('SSH-2.0-phpseclib_2.0', $identifier); - if (extension_loaded('libsodium')) { + if (function_exists('\\Sodium\\library_version_major')) { $this->assertContains('libsodium', $identifier); }