Recommend this page to a friend! |
Download .zip |
Info | Example | Videos | View files (7) | Download .zip | Reputation | Support forum (1) | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2023-10-26 (2 months ago) | Not enough user ratings | Total: 45 | All time: 10,687 This week: 118 |
Version | License | PHP version | Categories | |||
cryptonita 1.0.0 | MIT/X Consortium ... | 7.4 | Cryptography, PHP 7 |
The type of encryption method (e.g., "AES-256-CBC").
The exact method is defined in the external configuration file as METHOD.
An Initialization Vector (IV) is crucial for block cipher modes. In this mode, the IV is hashed to generate a derived value, and then the derived IV is trimmed to 16 bytes.
The exact value for the IV is defined in the external configuration file as SECRETIV.
The hashing algorithm derives the encryption key and IV from the secret IV.
The exact hash algorithm is defined in the external configuration file as HASH.
The hidden function checks for an action parameter:
If $action is 1, it encrypts the input string using the specified encryption method, key, and IV.
The encrypted data is then encoded with base64 to provide a string easily stored or transmitted without special encoding.
If $action is 2, it first decodes the input string using base64, then decrypts the data using the specified encryption method, key, and IV.
These functions are from PHP's OpenSSL extension, which provides a way to use the OpenSSL library for data encryption.
<?php |
A classe Crypto
é responsável por encriptar e descriptar informações usando a criptografia OpenSSL.
(criptografia simétrica) como o proposito exclusivo de esconder as informações no banco de dados e usar a mesma chave para mostrar os dados na aplicação
require __DIR__ ."/vendor/autoload.php";
use App\Cryptonita\Crypto;
Para criptografar informações, instancie a classe Crypto e utilize o método hidden passando o valor 1 como segundo argumento:
$cripto = new Crypto();
$nome = "XXXXXXX faustino";
$criptografado = $cripto->hidden($nome, 1);
Para descriptografar, utilize o método hidden passando o valor 2 como segundo argumento:
$nomeDescriptografado = $cripto->hidden($criptografado, 2);
### Exemplo Completo
require __DIR__ ."/vendor/autoload.php";
use App\Cryptonita\Crypto;
$cripto = new Crypto(); $nome="XXXXXXX faustino"; $email="XYZZZ@gmail.com"; $likedin="https://www.linkedin.com/in/XXXXXXXX/"; $site="https:XXXXXXXX.com"; $data=[$nome,$email,$likedin,$site]; $criptografado=[]; // resultado criptografado hidden(string) foreach ($data as $key => $value) {
$criptografado []= $cripto->hidden($value);
} echo "-------Resultado Criptografia---------------------"; var_dump($criptografado); echo "--------------------------------------------------"; // resultado Descriptografado show(string) $descriptografado=[]; foreach ($criptografado as $key => $value) {
$descriptografado[]= $cripto->show($value);
} echo "------Resultado Descriptografia-------------------"; var_dump($descriptografado); echo "--------------------------------------------------";
### Contribuindo
- Contribuições são bem-vindas! Sinta-se à vontade para abrir uma issue ou um pull request.
### Licença
O Cripto é licenciado sob a licença MIT.
Videos | ||
Files |
File | Role | Description | ||
---|---|---|---|---|
src (1 directory) | ||||
composer.json | Data | Auxiliary data | ||
composer.lock | Data | Auxiliary data | ||
index.php | Example | Example script | ||
README.md | Doc. | Documentation | ||
show.php | Example | Example script |
Files | / | src | / | Cryptonita |
File | Role | Description |
---|---|---|
config.php | Appl. | Configuration script |
Crypto.php | Class | Class source |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Comments (1) | |||||
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.