Recommend this page to a friend! |
![]() |
Info | Example | Videos | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 56 | All time: 10,587 This week: 35![]() |
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="[email protected]"; $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 (1) | ||
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Example | Example script | ||
![]() ![]() |
Doc. | Documentation | ||
![]() ![]() |
Example | Example script |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
![]() |
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.