Merge pull request #64 from cypherbits/faster-encryption-load
If admin defined keys with the right length, do not compute the keys.
This commit is contained in:
12
chat.php
12
chat.php
@ -4209,8 +4209,8 @@ function load_config(){
|
||||
define('VERSION', '1.24'); // Script version
|
||||
define('DBVERSION', 42); // Database layout version
|
||||
define('MSGENCRYPTED', false); // Store messages encrypted in the database to prevent other database users from reading them - true/false - visit the setup page after editing!
|
||||
define('ENCRYPTKEY_PASS', 'MY_SECRET_KEY'); // Encryption key for messages
|
||||
define('AES_IV_PASS', '1234567890123456'); //AES Encryption IV
|
||||
define('ENCRYPTKEY_PASS', 'MY_SECRET_KEY'); // Recommended length: 32. Encryption key for messages
|
||||
define('AES_IV_PASS', '012345678912'); // Recommended length: 12. AES Encryption IV
|
||||
define('DBHOST', 'localhost'); // Database host
|
||||
define('DBUSER', 'www-data'); // Database user
|
||||
define('DBPASS', 'YOUR_DB_PASS'); // Database password
|
||||
@ -4230,7 +4230,15 @@ function load_config(){
|
||||
define('LANG', 'en'); // Default language
|
||||
if (MSGENCRYPTED){
|
||||
//Do not touch: Compute real keys needed by encryption functions
|
||||
if (strlen(ENCRYPTKEY_PASS) !== SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES){
|
||||
define('ENCRYPTKEY', substr(hash("sha512/256",ENCRYPTKEY_PASS),0, SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES));
|
||||
}else{
|
||||
define('ENCRYPTKEY', ENCRYPTKEY_PASS);
|
||||
}
|
||||
if (strlen(AES_IV_PASS) !== SODIUM_CRYPTO_AEAD_AES256GCM_NPUBBYTES){
|
||||
define('AES_IV', substr(hash("sha512/256",AES_IV_PASS), 0, SODIUM_CRYPTO_AEAD_AES256GCM_NPUBBYTES));
|
||||
}else{
|
||||
define('AES_IV', AES_IV_PASS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user