summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Tcholakov <ivantcholakov@gmail.com>2015-03-16 21:05:45 +0200
committerIvan Tcholakov <ivantcholakov@gmail.com>2015-03-16 21:05:45 +0200
commite923c74d09080dec58ca5da743f5ca9fa476c20e (patch)
treea1813fa279f2abb2b4de33d690db4a99059acb85
parent9a39bbd04569472028b1d6d911d4d574a7431cba (diff)
downloadgibberish-aes-php-e923c74d09080dec58ca5da743f5ca9fa476c20e.zip
gibberish-aes-php-e923c74d09080dec58ca5da743f5ca9fa476c20e.tar.gz
gibberish-aes-php-e923c74d09080dec58ca5da743f5ca9fa476c20e.tar.bz2
Minor, cosmetic changes.
-rw-r--r--GibberishAES.php42
1 files changed, 17 insertions, 25 deletions
diff --git a/GibberishAES.php b/GibberishAES.php
index a96426b..01e5b34 100644
--- a/GibberishAES.php
+++ b/GibberishAES.php
@@ -54,20 +54,24 @@
class GibberishAES {
- protected static $key_size = 256; // The default key size in bits
- protected static $valid_key_sizes = array(128, 192, 256); // Sizes in bits
+ // The default key size in bits.
+ protected static $key_size = 256;
+
+ // The allowed key sizes in bits.
+ protected static $valid_key_sizes = array(128, 192, 256);
protected static $openssl_random_pseudo_bytes_exists = null;
protected static $mcrypt_dev_urandom_exists = null;
protected static $openssl_encrypt_exists = null;
protected static $openssl_decrypt_exists = null;
protected static $mcrypt_exists = null;
- protected static $openssl_cli_exists = null;
protected static $mbstring_func_overload = null;
+ protected static $openssl_cli_exists = null;
+
// This is a static class, instances are disabled.
- final private function __construct() {}
- final private function __clone() {}
+ final private function __construct() { }
+ final private function __clone() { }
/**
* Crypt AES (256, 192, 128)
@@ -183,14 +187,8 @@ class GibberishAES {
$newsize = (int) $newsize;
if (!$valid_integer || !in_array($newsize, self::$valid_key_sizes)) {
-
- trigger_error(
- 'GibberishAES: Invalid key size value was to be set. It should be integer value (number of bits) amongst: 128, 192, 256.',
- E_USER_WARNING
- );
-
+ trigger_error('GibberishAES: Invalid key size value was to be set. It should be an integer value (number of bits) amongst: '.implode(', ', self::$valid_key_sizes).'.', E_USER_WARNING);
} else {
-
self::$key_size = $newsize;
}
@@ -365,10 +363,7 @@ class GibberishAES {
return false;
}
- trigger_error(
- 'GibberishAES: System requirements failure, please, check them.',
- E_USER_WARNING
- );
+ trigger_error('GibberishAES: System requirements failure, please, check them.', E_USER_WARNING);
return false;
}
@@ -412,10 +407,7 @@ class GibberishAES {
return false;
}
- trigger_error(
- 'GibberishAES: System requirements failure, please, check them.',
- E_USER_WARNING
- );
+ trigger_error('GibberishAES: System requirements failure, please, check them.', E_USER_WARNING);
return false;
}
@@ -460,13 +452,13 @@ class GibberishAES {
protected static function strtohex($string) {
- $result = '';
+ $result = '';
- foreach (str_split($string) as $c) {
- $result .= sprintf("%02X", ord($c));
- }
+ foreach (str_split($string) as $c) {
+ $result .= sprintf("%02X", ord($c));
+ }
- return $result;
+ return $result;
}
protected static function escapeshellarg($arg) {