|
@@ -0,0 +1,48 @@
|
|
|
+#ifndef MAINWINDOW_H
|
|
|
+#define MAINWINDOW_H
|
|
|
+#include <QCryptographicHash>
|
|
|
+#include <QMainWindow>
|
|
|
+
|
|
|
+QT_BEGIN_NAMESPACE
|
|
|
+namespace Ui { class MainWindow; }
|
|
|
+QT_END_NAMESPACE
|
|
|
+
|
|
|
+class MainWindow : public QMainWindow
|
|
|
+{
|
|
|
+ Q_OBJECT
|
|
|
+
|
|
|
+public:
|
|
|
+ MainWindow(QWidget *parent = nullptr);
|
|
|
+ ~MainWindow();
|
|
|
+private slots:
|
|
|
+
|
|
|
+ void on_pushButton_clicked();
|
|
|
+private:
|
|
|
+ Ui::MainWindow *ui;
|
|
|
+ QString hashString(const QString &str) {
|
|
|
+ QString strippedStr = str;
|
|
|
+ strippedStr.remove(QChar('-'));
|
|
|
+ QByteArray hashData = QCryptographicHash::hash(strippedStr.toUtf8(), QCryptographicHash::Sha256);
|
|
|
+ QString hashedStr = QString::fromLatin1(hashData.toHex());
|
|
|
+ return hashedStr;
|
|
|
+ }
|
|
|
+ QString caesarCipher(const QString &text, int shift) {
|
|
|
+ QString result;
|
|
|
+ const int alphabetSize = 26;
|
|
|
+ const int digitSize = 10;
|
|
|
+
|
|
|
+ for (const QChar &ch : text) {
|
|
|
+ if (ch.isLetter()) {
|
|
|
+ QChar base = ch.isLower() ? 'a' : 'A';
|
|
|
+ result.append(QChar((ch.toLatin1() - base.toLatin1() + shift + alphabetSize) % alphabetSize + base.toLatin1()));
|
|
|
+ } else if (ch.isDigit()) {
|
|
|
+ result.append(QChar((ch.toLatin1() - '0' + shift + digitSize) % digitSize + '0'));
|
|
|
+ } else {
|
|
|
+ result.append(ch);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+};
|
|
|
+#endif // MAINWINDOW_H
|