public static function decrypt($encryptedString) { $clearText = \ipinga\crypto::decrypt($encryptedString); $a = json_decode($clearText, true); return $a; }
/** * @param string $encryptedString (created by printableEncrypt()) * * @return array Decrypted original value */ public static function printableDecrypt($encryptedString) { $a = json_decode(\ipinga\crypto::decrypt(hex2bin($encryptedString)), true); return $a['k']; }
/** * Some other function prepares this and does all the binding. All I am doing here is executing it in a common * fashion and populating all the fields() array * * @param \PDOStatement $stmt */ protected function _process_loadby_execute($stmt) { try { $stmt->execute(); $row = $stmt->fetch(\PDO::FETCH_ASSOC); foreach ($this->fieldTypes as $fieldName => $fieldType) { if ($fieldName == 'passwd') { $this->field[$fieldName] = \ipinga\crypto::decrypt(hex2bin($row['passwd'])); } else { $this->field[$fieldName] = $row[$fieldName]; } } if ($this->field['id'] < 1) { $this->saved = false; } else { $this->saved = true; } } catch (\Exception $e) { echo $e->getMessage() . '<br><hr>'; $this->saved = false; } }