An open API service indexing awesome lists of open source software.

https://github.com/eiblybrasil/php-crypt

A simple php class for encryption.
https://github.com/eiblybrasil/php-crypt

class cryptography php php72 php73 php74 php80 php81

Last synced: 6 days ago
JSON representation

A simple php class for encryption.

Awesome Lists containing this project

README

          

## Using
```php
encrypt("content");
// Result: $value = MDI2NTYwYTM5N2FiZWY0MDRmM2I5ZDU2OTM5OTg!NmRiZTYVZAuvIFt2Xm@eVug0eN)!A

// function decrypt(string $string): ?string
$decrypted_value = $crypt->decrypt($value);
// Result: $decrypted_value = content
```

## Warnings:
By default the salt mode will be used, but be careful.
When running the first time, it will create a json file with an array of salts.
Once stored, it will be used to decrypt. Be aware that deleting the file will make it impossible to decrypt the string in the future.

## Functions
```php
function setSaltStatus(bool $salt): void {...}
function getSaltStatus(): bool {...}
function setHash(string $hash): void {...}
function getHash(): string {...}
function setKey(string $key): void {...}
function getKey(): string {...}
function setMethod(string $method): void {...}
function getMethod(): string {...}
function doGenerateSalts(int $c = 16, int $l = 8): array {...}
function doGenerateSalt(int $len = 8): array {...}
function encrypt(string $string): string {...}
function decrypt(string $string): ?string {...}
```