pandora-una / paillier
Cript e Decript do Paillier.
Installs: 1 010
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 1
Type:project
Requires
- php: >=7.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- php-mock/php-mock-phpunit: ^2.6
- phpunit/phpunit: ^9.1
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2025-01-06 18:33:57 UTC
README
Criptografia de Paillier
Instalação
$ composer require pandora-una/paillier
Uso
Gerar Chaves
$paillier = new Paillier(); //chave privada $paillier->getPrivateKey(); //chave publica $paillier->getPublicKey());
Criptografar
$paillier = new Paillier(); $msg = 123456781; $encript = $paillier->getPublicKey()->encrypt($msg); $msgDecript = $paillier->getPrivateKey()->decrypt($encript);
Soma
$paillier = new Paillier(); $v1 = 10; $e1 = $paillier->getPublicKey()->encrypt($v1); v2 = 15; $e2 = $paillier->getPublicKey()->encrypt($v2); $v3 = 3; $e3 = $paillier->getPublicKey()->encrypt($v3); $res = Paillier::sum($e1,$e2,$e3); $dec = $paillier->getPrivateKey()->decrypt($res); echo $dec; //= 28