function uc_encryption_class::convertKey in Ubercart 6.2
Converts encryption key into an array of numbers.
Parameters
$key: Encryption key.
Return value
Array of integers.
2 calls to uc_encryption_class::convertKey()
- uc_encryption_class::decrypt in uc_store/
uc_store.module - Decrypts cyphertext.
- uc_encryption_class::encrypt in uc_store/
uc_store.module - Encrypts plaintext.
File
- uc_store/
uc_store.module, line 2060 - Contains global Ubercart functions and store administration functionality.
Class
- uc_encryption_class
- Handle encryption of credit-card information.
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(self::$scramble1, $char);
if ($num === FALSE) {
$this->errors[] = "Key contains an invalid character ({$char})";
return;
}
$array[] = $num;
$tot = $tot + $num;
}
$array[] = $tot;
return $array;
}