function uc_encryption_class::_convertKey in Ubercart 5
2 calls to uc_encryption_class::_convertKey()
- uc_encryption_class::decrypt in uc_store/
uc_store.module - uc_encryption_class::encrypt in uc_store/
uc_store.module
File
- uc_store/
uc_store.module, line 2816 - Contains global Ubercart functions and store administration functionality.
Class
- uc_encryption_class
- Trimmed down version of GPL class by Tony Marston. Details available at http://www.tonymarston.co.uk/php-mysql/encryption.html
Code
function _convertKey($key) {
if (empty($key)) {
// Commented out to prevent errors getting logged for use cases that may
// have variable encryption/decryption requirements. -RS
// $this->errors[] = 'No value has been supplied for the encryption key';
return;
}
$array[] = strlen($key);
$tot = 0;
for ($i = 0; $i < strlen($key); $i++) {
$char = substr($key, $i, 1);
$num = strpos($this->scramble1, $char);
if ($num === false) {
$this->errors[] = "Key contains an invalid character ({$char})";
return;
}
$array[] = $num;
$tot = $tot + $num;
}
$array[] = $tot;
return $array;
}