New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

ade_4d3/php-crypto-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ade_4d3/php-crypto-wrapper

Encryption operations wrapper with sodium for PHP

Source
Packagist
Version
v1.1.0
Version published
Total downloads
1
Maintainers
1
Created
Source

PHPCryptoWrapper

This is a wrapper of sodium for simplifyty cryptograpy operations Empaquetado para simplificación de operaciones criptográficas usando Sodium

This is Free Software with MIT License/ Software libre bajo licencia MIT

Aviable:

  • Argon2id
  • AES-256-GCM
  • ChaCha20-Poly1305

Usage

use PhpCryptoWrapper

Argon

use PhpCryptoWrapper\Argon;

Argon::hash($pass);

Argon::verify($text, $hash); // return bool

$salt = Argon::salt();
Argon::derivation($length, $salt, $text); // Derive a password however or with SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES 

AES

use PhpCryptoWrapper\AES;

$key = AES::genKey(); // O you can use Argon::derivation with SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES
$additional_data = // Any data ...
[$nonce, $ciphertext] = AES::encrypt($plaintext, $additional_data, $key);

$plaintext = AES::decrypt($ciphertext, $additional_data, $nonce, $key)

ChaCha20Poly1320

use PhpCryptoWrapper\ChaCha20Poly1305;

// [
//   "ChaCha20Poly1305",
//   "ChaCha20Poly1305-IETF",
//   "XChaCha20Poly1305",
// ]
$chacha20 = new ChaCha20Poly1305($algo); // By default XChaCha20Poly1305
$key = $chacha20->genKey(); // Key o wiht Argon

$additional_data = "anydata";
[$nonce, $ct] = $chacha20->encrypt("Asupersecret", $additional_data, $key);

echo $chacha20->decrypt($ct, $additional_data, $nonce, $key) . "\n";

Keywords

cryptography

FAQs

Package last updated on 20 Dec 2025

Related posts