Beispiel #1
0
 /**
  * Function: getKeyHash
  *
  * Utility function to retrieve the encryption key used by the
  * encryption algorithm based on the master key, the sub-key, and some
  * known, random seed. The hash returned should be used as the binary key
  * for the encryption algorithm.
  *
  * Parameters:
  * seed - (string) third-level seed for the encryption key. This will
  *      likely an IV or salt value
  * len - (int) length of the desired hash
  */
 function getKeyHash($seed, $len = 32)
 {
     $hash = Crypto::hash($this->getMasterKey() . md5($this->getSubKey()), $seed);
     return substr($hash, 0, $len);
 }