Add CI_Encryption::create_key()
This was planned, we somehow forgot about it. :)
diff --git a/system/libraries/Encryption.php b/system/libraries/Encryption.php
index d6ffc9b..aa91cd3 100644
--- a/system/libraries/Encryption.php
+++ b/system/libraries/Encryption.php
@@ -310,6 +310,21 @@
// --------------------------------------------------------------------
/**
+ * Create a random key
+ *
+ * @param int $length Output length
+ * @return string
+ */
+ public function create_key($length)
+ {
+ return ($this->_driver === 'mcrypt')
+ ? mcrypt_create_iv($length, MCRYPT_DEV_URANDOM)
+ : openssl_random_pseudo_bytes($length);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Encrypt
*
* @param string $data Input data