Some PHP improvements and little fixes

This commit is contained in:
Bizarrus committed 2023-11-04 04:00:10 +01:00
1 parent 558ef8a36e
commit c596aabda8
31 files changed
+182 -183

No files matched your search

+2 -2
View File
@@ -2,11 +2,11 @@
namespace fruithost;
class Encryption {
public static function encrypt(string $data, string $secret) : string | false {
public static function encrypt(string $data, #[\SensitiveParameter] string $secret) : string | false {
return base64_encode(openssl_encrypt($data, 'aes-256-cbc', $secret, 0, substr(ENCRYPTION_SALT, 0, 16)));
}
public static function decrypt(string $data, string $secret) : string | false {
public static function decrypt(string $data, #[\SensitiveParameter] string $secret) : string | false {
return openssl_decrypt(base64_decode($data), 'aes-256-cbc', $secret, 0, substr(ENCRYPTION_SALT, 0, 16));
}
}