Merge branch 'master' into feature-3716/Messaging_inbox_outbox_user

This commit is contained in:
Paolo
2020-02-04 17:16:17 +01:00
59 changed files with 1233 additions and 9617 deletions
+28
View File
@@ -0,0 +1,28 @@
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
use phpseclib\Crypt\Rijndael;
/**
* Collection of different encryption/hashing algorithms
*/
class CryptLib
{
/**
* Encrypt using the Rijndael algorithm with a key length of 256 bits and the ECB mode
* It is possible to disable the padding, enabled by default
*/
public static function RIJNDAEL_256_ECB($value, $key, $paddingDisabled = false)
{
if (isEmptyString($key) || strlen($value) % 32 != 0) return null;
$cipher = new Rijndael(Rijndael::MODE_ECB);
$cipher->setBlockLength(256);
$cipher->setKey($key);
if ($paddingDisabled === true) $cipher->disablePadding();
return $cipher->encrypt($value);
}
}