| 710 | } |
| 711 | |
| 712 | QString BridgeApp::encode_data(const QString &algorithm, const QString &data, const QString &key) const |
| 713 | { |
| 714 | QByteArray bytes = data.toUtf8(); |
| 715 | QString alg = algorithm.toLower(); |
| 716 | |
| 717 | if (alg == "hex") |
| 718 | return QString::fromLatin1(bytes.toHex()); |
| 719 | if (alg == "base64") |
| 720 | return QString::fromLatin1(bytes.toBase64()); |
| 721 | if (alg == "base32") |
| 722 | return QString::fromLatin1(encodeBase32(bytes)); |
| 723 | if (alg == "zip") |
| 724 | return QString::fromLatin1(qCompress(bytes).toBase64()); |
| 725 | if (alg == "xor") |
| 726 | return QString::fromLatin1(applyXor(bytes, key.toUtf8()).toBase64()); |
| 727 | |
| 728 | return data; |
| 729 | } |
| 730 | |
| 731 | QString BridgeApp::decode_data(const QString &algorithm, const QString &data, const QString &key) const |
| 732 | { |
nothing calls this directly
no test coverage detected