-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcezar.cpp
47 lines (38 loc) · 1.07 KB
/
cezar.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "cezar.h"
#include <QDebug>
Cezar::Cezar(){}
Cezar::~Cezar(){
delete Cezar::inst;
}
QByteArray* Cezar::Szyfruj(Klucz* Klucz, QString* tresc){
/*QByteArray* by = new QByteArray(tresc->toUtf8());
for(int i = tresc->indexOf((char)(18))+1; i < by->length(); ++i)
{
by->operator [](i) = by->operator [](i) + 1;
}
return by;*/
qDebug()<< "szyfruje Cezar";
return new QByteArray(tresc->toUtf8());
}
QString* Cezar::Deszyfruj(Klucz* klucz, QByteArray* tresc){
/*for(int i = tresc->indexOf((char)(18))+1; i < tresc->length(); ++i)
{
tresc->operator [](i) = tresc->operator [](i) - 1;
}
return new QString(*tresc);*/
qDebug()<< "deszyfruje Cezar";
return new QString(*tresc);
}
Klucz* Cezar::GenerujKlucz(QByteArray* klucz){
this->klucz = new Klucz(TypKlucza::symetryczny);
return this->klucz;
}
Cezar* Cezar::instancja()
{
if(Cezar::inst == nullptr)
{
Cezar::inst = new Cezar();
}
return Cezar::inst;
}
Cezar* Cezar::inst = nullptr;