Advanced search

QtQt/C++ - Tutorial 069. XOR Encryption

July 23, 2017, 9:27 a.m.

XOR, cmake, Qt

XOR-encryption is the application of a key through bitwise exclusive OR to the source text. The mechanism of the bitwise exclusive is the following:

0 0 0
0 1 1
1 0 1
1 1 0

Thus, when executing an exclusive OR, there will always be a zero value if the variables have the same values.

The peculiarity of XOR is that one and the same function can both encrypt data and decrypt it. This is a simple method of data encryption, which can be hacked quickly enough if there is a large enough encrypted text, or a large password dictionary. But nevertheless, this can already be used for small initial data protection.

In the context of Qt, the use of XOR is no different from how the program was written without using Qt. The question here is how to extract data for encryption from QString objects, for example, if the text was entered in QTextEdit.

To do this, write a program that contains:

  • QTextEdit, In which the text will be entered, which will be encrypted.
  • QLineEdit, In which the encryption key will be entered.
  • QPushButton, In the slot of the click handler of which, data encryption / decryption will be performed. Again, I note that the method will be used the same.

The program will look like this:

QtQt/C++ - Tutorial 068. Hello World using the CMAKE build system in CLion

July 23, 2017, 4:05 a.m.

Qt, cmake, C++

Write "Hello, World !!!" On Qt in the IDE CLion using the CMAKE build system. The emphasis on the fact that the project is being developed in IDE CLion was made because to work with the project it is necessary to make a small adjustment for working with CMAKE .

The result is the following application:

How to become an author?

Contribute to the evolution of the EVILEG community.

Learn how to become a site author.

Learn it

Good day, Dear Users!!!

I am Evgenii Legotckoi, developer of EVILEG. And it is my hobby project, which helps to learn programming another programmers and developers

If the site helped you, and you want also support the development of the site, than you can donate by following ways


Let me recommend you the excellent hosting on which EVILEG is located.

For many years, Timeweb has been proving his stability.

For projects on Django I recommend VDS hosting

View Hosting Timeweb
June 3, 2020, 2:56 a.m.

C++ - Тест 003. Условия и циклы

  • Result:35points,
  • Rating points-10
June 2, 2020, 10:11 p.m.
Aleksej Pikenin

C++ - Test 005. Structures and Classes

  • Result:75points,
  • Rating points2
June 2, 2020, 2:04 p.m.
Daniil Chizhevskij

C++ - Test 001. The first program and data types

  • Result:86points,
  • Rating points6
Last comments
June 5, 2020, 2:27 a.m.

Qt/C++ - Tutorial 091. How to write a custom delegate controlling the highlighting of a row in a table

Разобрался. У вас изначально в проекте были вот эти настройки: ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);ui->tableView->setSelectionMode(QAbstractItemVie…
June 4, 2020, 12:10 p.m.

Qt/C++ - Tutorial 091. How to write a custom delegate controlling the highlighting of a row in a table

Полностью скопировал пример - всё правильно работает. Значит, где-то у меня ошибки в тестовом проекте. Буду разбираться. Извините за беспокойство. :)
June 4, 2020, 8:08 a.m.
Evgenij Legotskoj

Qt/C++ - Tutorial 091. How to write a custom delegate controlling the highlighting of a row in a table

Во все колонки установили? Нужно на все колонки устанавливать.
June 4, 2020, 7:59 a.m.

Qt/C++ - Tutorial 091. How to write a custom delegate controlling the highlighting of a row in a table

Код делегата полностью скопировал в свой тестовый проект, но окрашивается не вся строка целиком, а только ячейка, на которую указывает курсор.
Now discuss on the forum
June 4, 2020, 3:46 a.m.
Mihail A

Qt- C++ QTableView подсветить строку

June 3, 2020, 2:49 a.m.

Можно ли сделать в QML таблицу как в Excel?

edi-tableview - нашел пока такое выглядит коряво, посмотрим что можно сделать
June 2, 2020, 3:46 a.m.
Evgenij Legotskoj

Медиа файлы Google Firebase

Картинки можете попробовать сжимать через QPixmap, там есть возможность установки scaleFactor, через него можете устанавливать нужные параметры. А что касается конвертации видео, то лучше п…
June 2, 2020, 3:01 a.m.
Evgenij Legotskoj

Перехват обращения к локальным файлам QWebEngineView

В вашем случае вполне адекватное решение. Так сказать меньше зло. В противном случае пришлось бы очень много переписывать и перепиливать.
June 1, 2020, 11:26 a.m.

SSL на Android

у меня стоит версия Qt 5.14.2. В настройках android поставил openssl из коробки, и этот прроект автоматически стянулся. Достаточно было только добавить в .pro-файл строку после этого и все …
© EVILEG 2015-2020
Recommend hosting TIMEWEB