Thursday, January 1, 2015

AES crypter in Qt5

One simple implementation ... just for fun ...

Please refactor as you like. Yes, it is "horrible" ... / . \ , yes, it is unconventional  ... but there is a reason ...

AES-256, little-endian -- A build of this code in big-endian environment has not been tested.



AAES0.h


/*AAES0.h*/
#pragma once
/*1:eCV eCI eCC*//*VC++ Intel Clang*/
#define eCG/*GCC*/
#if defined eCG||defined eCC
#define okN(p)__attribute__((aligned(p)))
#elif defined eCV
#define okN(p)__declspec(align(p))
#endif
#define rKz const
#define rRt return
#define rOp operator
#define rLn inline
#define ig else if
#define ih else
#define rEp noexcept
#define rEV throw(tHr)
#define rKx constexpr
#define rKE const noexcept
#define rKV const throw(tHr)
#define rTh(p)throw(tHr)p
#define rFV catch(tHr)
#define rFW catch(tHr){throw;}
#define rFV catch(tHr)
#define rSt static
#define rXp explicit
#include<stdint.h>
#include<stddef.h>
typedef uint8_t t1u;typedef int8_t t1s;
typedef uint16_t t2u;typedef int16_t t2s;
typedef uint32_t t4u;typedef int32_t t4s;
typedef uint64_t t8u;typedef int64_t t8s;
typedef float t4f;typedef double t8f;
typedef char t1k;
typedef char16_t t2k;typedef char32_t t4k;typedef wchar_t twk;
typedef size_t tpu;typedef ptrdiff_t tps;
typedef tps tHr;
typedef t1u tWU1;
typedef t4u tWU4;
typedef char const*tSQ;
typedef bool tBu;
typedef void voi;
static rKx tBu const cBuA=1;
static rKx tBu const cBuB=0;
#define oOpDFS(_)_&rOp=(_ rKz&)rEp=default;_&rOp=(_&&)rEp=default;constexpr _(_ rKz&)rEp=default;constexpr _(_&&)rEp=default;_()rEp=default;

AAESFi.h


/*AAESFi.h*/
#pragma once
#include<AAES0.h>
#include<fstream>
struct tFi{private:mutable FILE*m;public:
oOpDFS(tFi)
typedef t8u tL;
tBu ____gh()rKE{rRt(tBu)!!m;}
voi fh(FILE*p)rEp{m=(FILE*)p;}
voi ARA_h(t1k const&)rEV;voi ARA_h(twk const&)rEV;
voi ARB_h(t1k const&)rEV;voi ARB_h(twk const&)rEV;
voi AWA_h(t1k const&)rEV;voi AWA_h(twk const&)rEV;
voi AWB_h(t1k const&)rEV;voi AWB_h(twk const&)rEV;
voi AWT_h(t1k const&)rEV;voi AWT_h(twk const&)rEV;
voi AA__h(t1k const&)rEV;voi AA__h(twk const&)rEV;
voi AAP_h(t1k const&)rEV;voi AAP_h(twk const&)rEV;
voi A__(t1k const&,t1k const&)rEV;
voi B()rEp{fclose(m);}
FILE*____gP()rEp{rRt m;}
voi uK_h__(t1u)rKV;
t4u kRd(voi*,t4u)rKE;
t4u kRi(voi const*,t4u)rKE;
t4u kRd_h(voi*,t4u)rKV;
t4u kRi_h(voi const*,t4u)rKV;
tBu kbRd(voi*,t4u)rKE;
tBu kbRi(voi const*,t4u)rKE;
voi uRd_h(voi*,t4u)rKV;
voi uRi_h(voi const*,t4u)rKV;
voi uSkSt_h(tL)rKV;
voi uSkCr_h(tL)rKV;
voi uSkBF_h(tL)rKV;/*
voi uSkSt_h(tII8)rKV;
voi uSkCr_h(tII8)rKV;
voi uSkBF_h(tII8)rKV;*/
#ifdef eCV
template<typename...t>tBu kbSn(t1k const&p,t...q)rKE{rRt(tBu)(std::fscanf_s(m,&p,q...)!=EOF);}
#else
template<typename...t>tBu kbSn(t1k const&p,t...q)rKE{rRt(tBu)(std::fscanf(m,&p,q...)!=EOF);}
#endif
tL kTl_h()rKV;
tL kLh_h()rKV;
rSt tL xLh_h(t1k const&)rEV;rSt tBu xbb(t1k const&)rEp;
rSt tL xLh_h(twk const&)rEV;rSt tBu xbb(twk const&)rEp;
voi uK_h(t1u)rKV;
voi uK_h(tSQ)rKV;
t1u kK_h()rKV;
t4u gN_h()rKV;
template<typename...t>t4s kPn(t1k const&p,t...q)rKE{rRt fprintf(m,&p,q...);}};

AAESFi.cpp


/*AAESFi.cpp*/
#include<AAESFi.h>
#include<cstring>
#ifdef eCV
#define o_FO1(m,A,F)fopen_s(&m,A,F)
#else
#define o_FO1(m,A,F)m=fopen(A,F)
#endif
#define o_r_ "r"
#define o_rb "rb"
#define o_w_ "w"
#define o_wb "wb"
#define o_wt "wt"
#define o_a_ "a"
#define o_aP "a+"
#define o_FO2(m,A,F){t1k l[0x1000];std::memset(l,0,0x1000),wcstombs((t1k*)&l,&A,0xFFF);o_FO1(m,(t1k const*)&l,F);}
/*iconv_t i=iconv_open("UTF-8","UTF-16");
iconv(i,&a,&c,&b,&d);
iconv_close(i);*/
voi tFi::ARA_h(t1k const&p)rEV{o_FO1(m,&p,o_r_);if(!m){throw(tHr)0x45;}}voi tFi::ARA_h(twk const&p)rEV{o_FO2(m,p,o_r_);if(!m){throw(tHr)0x45;}}
voi tFi::ARB_h(t1k const&p)rEV{o_FO1(m,&p,o_rb);if(!m){throw(tHr)0x45;}}voi tFi::ARB_h(twk const&p)rEV{o_FO2(m,p,o_rb);if(!m){throw(tHr)0x45;}}
voi tFi::AWA_h(t1k const&p)rEV{o_FO1(m,&p,o_w_);if(!m){throw(tHr)0x45;}}voi tFi::AWA_h(twk const&p)rEV{o_FO2(m,p,o_w_);if(!m){throw(tHr)0x45;}}
voi tFi::AWB_h(t1k const&p)rEV{o_FO1(m,&p,o_wb);if(!m){throw(tHr)0x45;}}voi tFi::AWB_h(twk const&p)rEV{o_FO2(m,p,o_wb);if(!m){throw(tHr)0x45;}}
voi tFi::AWT_h(t1k const&p)rEV{o_FO1(m,&p,o_wt);if(!m){throw(tHr)0x45;}}voi tFi::AWT_h(twk const&p)rEV{o_FO2(m,p,o_wt);if(!m){throw(tHr)0x45;}}
voi tFi::AA__h(t1k const&p)rEV{o_FO1(m,&p,o_a_);if(!m){throw(tHr)0x45;}}voi tFi::AA__h(twk const&p)rEV{o_FO2(m,p,o_a_);if(!m){throw(tHr)0x45;}}
voi tFi::AAP_h(t1k const&p)rEV{o_FO1(m,&p,o_aP);if(!m){throw(tHr)0x45;}}voi tFi::AAP_h(twk const&p)rEV{o_FO2(m,p,o_aP);if(!m){throw(tHr)0x45;}}
#undef o_r_
#undef o_rb
#undef o_w_
#undef o_wb
#undef o_wt
#undef o_a_
#undef o_aP
voi tFi::A__(t1k const&p,t1k const&q)rEV{o_FO1(m,&p,&q);if(!m){throw(tHr)0x45;}}
voi tFi::uK_h__(t1u p)rKV{if(ungetc(p,m)==EOF){rTh(0);}}
t4u tFi::kRd(voi*p,t4u q)rKE{rRt fread(p,1,q,m);}
t4u tFi::kRi(voi const*p,t4u q)rKE{rRt fwrite(p,1,q,m);}
tBu tFi::kbRd(voi*p,t4u q)rKE{rRt(tBu)(kRd(p,q)==q);}
tBu tFi::kbRi(voi const*p,t4u q)rKE{rRt(tBu)(kRi(p,q)==q);}
voi tFi::uRd_h(voi*p,t4u q)rKV{if(kRd(p,q)!=q){throw;}}
voi tFi::uRi_h(voi const*p,t4u q)rKV{if(kRi(p,q)!=q){throw;}}
voi tFi::uSkSt_h(tL p)rKV{if(fseek(m,(t8u)p,SEEK_SET)){rTh(0);}}
voi tFi::uSkCr_h(tL p)rKV{if(fseek(m,(t8u)p,SEEK_CUR)){rTh(0);}}
voi tFi::uSkBF_h(tL p)rKV{if(fseek(m,(t8u)p,SEEK_END)){rTh(0);}}/*
voi tFi::uSkSt_h(tII8 p)rKV{if(fseek(m,(t8s)p,SEEK_SET)){rTh(0);}}
voi tFi::uSkCr_h(tII8 p)rKV{if(fseek(m,(t8s)p,SEEK_CUR)){rTh(0);}}
voi tFi::uSkBF_h(tII8 p)rKV{if(fseek(m,(t8s)p,SEEK_END)){rTh(0);}}*/
tFi::tL tFi::kTl_h()rKV{t8s l=ftell(m);if(l==-1L){rTh(0);}rRt(tL)(t8u)l;}
tFi::tL tFi::kLh_h()rKV{tL l;try{uSkBF_h((tL)0),l=kTl_h();}rFW rRt l;}
tFi::tL tFi::xLh_h(t1k const&p)rEV{tFi F;tL l;try{F.ARB_h(p),l=F.kLh_h();}rFW F.B();rRt l;}
tFi::tL tFi::xLh_h(twk const&p)rEV{tFi F;tL l;try{F.ARB_h(p),l=F.kLh_h();}rFW F.B();rRt l;}
tBu tFi::xbb(t1k const&p)rEp{tFi l;try{l.ARB_h(p);}rFV{rRt cBuB;}l.B();rRt cBuA;}
tBu tFi::xbb(twk const&p)rEp{tFi l;try{l.ARB_h(p);}rFV{rRt cBuB;}l.B();rRt cBuA;}
voi tFi::uK_h(t1u p)rKV{if(fputc(p,m)==EOF){rTh(0);}}
voi tFi::uK_h(tSQ p)rKV{if(fputs(p,m)==EOF){rTh(0);}}
t1u tFi::kK_h()rKV{t4s l=fgetc(m);if(l==EOF){rTh(0);}rRt(t1u)l;}
t4u tFi::gN_h()rKV{t4s l=fileno(m);if(l==-1){rTh(0);}rRt(t4u)l;}
#undef o_FO1
#undef o_FO2

#if 0
int main_file(){
tFi l;
if(tFi::xbb(*"GAGAGA")){return 0;}
try{l.AWB_h(*"GAGAGA");}rFV{goto la1;}
try{
l.uRi_h("GAGAGA",6);}rFV{goto la2;}
la2:
l.B();
la1:
return 0;}
#endif

AAESP.h


/*AAESP.h*/
#pragma once
#include<AAESFi.h>
#include<cstring>
union okN(0x10)tu10{
struct{t8u m1,m2;}u8;
struct{t1u m1,m2,m3,m4,m5,m6,m7,m8,m9,mA,mB,mC,mD,mE,mF,mG;}u1;
struct{t1s m1,m2,m3,m4,m5,m6,m7,m8,m9,mA,mB,mC,mD,mE,mF,mG;}s1;
struct{t2u m1,m2,m3,m4,m5,m6,m7,m8;}u2;
struct{t2s m1,m2,m3,m4,m5,m6,m7,m8;}s2;
struct{t4u m1,m2,m3,m4;}u4;
struct{t4s m1,m2,m3,m4;}s4;
struct{t4f m1,m2,m3,m4;}f4;
struct{t8s m1,m2;}s8;
struct{t8f m1,m2;}g8;};
union okN(0x20)tu20{
struct{t8u m1,m2,m3,m4;}u8;
struct{t8s m1,m2,m3,m4;}s8;
struct{tu10 m1,m2;}m10t;};
rKx rSt t1u __x(tSQ p)rEp{rRt t1u(((p[0]<0x3A?p[0]-0x30:p[0]<0x5B?p[0]-0x37:p[0]-0x57)<<4)|((p[1]<0x3A?p[1]-0x30:p[1]<0x5B?p[1]-0x37:p[1]-0x57)));}
rLn voi wEq_10(tu10&a,tu10 const&b)rEp{a=b;}
rLn voi wEq_20(tu20&a,tu20 const&b)rEp{wEq_10(a.m10t.m1,b.m10t.m1),wEq_10(a.m10t.m2,b.m10t.m2);}
rLn rSt voi wEq_10(tu10&p,tSQ q)rEp{t4u i=0x10;while(i--){((tWU1*)&p)[i]=__x(q+(i<<1U));}}
rLn rSt voi wEq_20(tu20&p,tSQ q)rEp{t4u i=0x20;while(i--){((tWU1*)&p)[i]=__x(q+(i<<1U));}}
rSt rKx tHr const __cIO=0x5353;

struct okN(0x10)tAEB{public:union{tu10 m;struct{tWU4 m1,m2,m3,m4;}u;}m;
oOpDFS(tAEB)
rXp tAEB(t1u const*p)rEp{std::memcpy(&m,p,0x10);}
rXp tAEB(tSQ p)rEp{wEq_10(m.m,p);}};
struct okN(0x20)tAEK{private:tu20 m;public:rSt tAEK const cKy;
oOpDFS(tAEK)
rXp tAEK(t1u const*p)rEp{std::memcpy(&m,p,0x20);}
rXp tAEK(tSQ p)rEp{wEq_20(m,p);}};
struct okN(0x10)tAER{public:tu10 m[15];tAER(){}tAER(tAEK const&);};
struct tAEP{private:tAEK mAEK;tAER mAER;public:
voi A(tAEB const&,tAEB&)rKE;voi A_h(tFi const&,tFi&)rKV;
voi B(tAEB const&,tAEB&)rKE;voi B_h(tFi const&,tFi&)rKV;
rXp tAEP(tAEK const&p)rEp:mAEK(p),mAER(mAEK){}oOpDFS(tAEP)};

AAESP.cpp


/*AAESP.cpp*/
#include<AAESP.h>
rSt rKx tWU1 const cBx_[0x100]={
(tWU1)0x63,(tWU1)0x7C,(tWU1)0x77,(tWU1)0x7B,(tWU1)0xF2,(tWU1)0x6B,(tWU1)0x6F,(tWU1)0xC5,(tWU1)0x30,(tWU1)0x01,(tWU1)0x67,(tWU1)0x2B,(tWU1)0xFE,(tWU1)0xD7,(tWU1)0xAB,(tWU1)0x76,(tWU1)0xCA,(tWU1)0x82,(tWU1)0xC9,(tWU1)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<<0x08U)|
((tWU4)A[(p>>0x10U)&0xFF]<<0x10U)|((tWU4)A[(p>>0x18U)&0xFF]<<0x18U);}
rSt rKx tWU4 _x_SBxA(tWU4 p)rEp{rRt _x_SV(cBx_,p);}
rSt rKx tWU4 _x_SBxB(tWU4 p)rEp{rRt _x_SV(cBxI,p);}
rSt rKx tWU4 _x_XTm4(tWU4 p)rEp{rRt((p<<1U)&(tWU4)0xFEFEFEFEU)^(
(((p&(tWU4)0x00000080U))?(tWU4)0x0000001BU:(tWU4)0U)|
(((p&(tWU4)0x00008000U))?(tWU4)0x00001B00U:(tWU4)0U)|
(((p&(tWU4)0x00800000U))?(tWU4)0x001B0000U:(tWU4)0U)|
(((p&(tWU4)0x80000000U))?(tWU4)0x1B000000U:(tWU4)0U));}
rSt rKx tWU4 _x_Ml(tWU4 x,tWU4 y)rEp{rRt
((y&(tWU4)0x01U)?x:(tWU4)0)^
((y&(tWU4)0x02U)?_x_XTm4(x):(tWU4)0)^
((y&(tWU4)0x04U)?_x_XTm4(_x_XTm4(x)):(tWU4)0)^
((y&(tWU4)0x08U)?_x_XTm4(_x_XTm4(_x_XTm4(x))):(tWU4)0)^
((y&(tWU4)0x10U)?_x_XTm4(_x_XTm4(_x_XTm4(_x_XTm4(x)))):(tWU4)0);}
rSt tu10 xXO_10(tu10 const&a,tu10 const&b)rEp{tu10 l;l.u8.m1=a.u8.m1^b.u8.m1;l.u8.m2=a.u8.m2^b.u8.m2;rRt l;}
rSt voi _w_RK(tAEB&p,tu10 const&q)rEp{(tu10&)p=xXO_10((tu10 const&)p,q);}
rSt rKx rLn t1u __xI(t1u p,t1u q)rEp{rRt(t1u)((t1u)(p<<q)|(t1u)(p>>(0x08-q)));}
rSt rKx rLn t1u __xR(t1u p,t1u q)rEp{rRt(t1u)((t1u)(p>>q)|(t1u)(p<<(0x08-q)));}
rSt rKx rLn t2u __xI(t2u p,t1u q)rEp{rRt(t2u)((t2u)(p<<q)|(t2u)(p>>(0x10-q)));}
rSt rKx rLn t2u __xR(t2u p,t1u q)rEp{rRt(t2u)((t2u)(p>>q)|(t2u)(p<<(0x10-q)));}
rSt rKx rLn t4u __xI(t4u p,t1u q)rEp{rRt(p<<q)|(p>>(0x20-q));}
rSt rKx rLn t4u __xR(t4u p,t1u q)rEp{rRt(p>>q)|(p<<(0x20-q));}
rSt rKx rLn t8u __xI(t8u p,t1u q)rEp{rRt(p<<q)|(p>>(0x40-q));}
rSt rKx rLn t8u __xR(t8u p,t1u q)rEp{rRt(p>>q)|(p<<(0x40-q));}
rSt tu10 _x_Tp(tu10 const&p)rEp{tu10 l;
l.u1.m1=p.u1.m1,l.u1.m2=p.u1.m5,l.u1.m3=p.u1.m9,l.u1.m4=p.u1.mD,
l.u1.m5=p.u1.m2,l.u1.m6=p.u1.m6,l.u1.m7=p.u1.mA,l.u1.m8=p.u1.mE,
l.u1.m9=p.u1.m3,l.u1.mA=p.u1.m7,l.u1.mB=p.u1.mB,l.u1.mC=p.u1.mF,
l.u1.mD=p.u1.m4,l.u1.mE=p.u1.m8,l.u1.mF=p.u1.mC,l.u1.mG=p.u1.mG;rRt l;}
rSt rKx tWU4 const cNr=(tWU4)256;/*128 192 256*/
rSt rKx tWU4 const cNk=cNr>>5U;
rSt rKx tWU4 const cNr2=cNk+(tWU4)6;
tAEK const tAEK::cKy((t1u*)"43003016030260020201900514007014");
tAER::tAER(tAEK const&p){wEq_20((tu20&)*this,(tu20 const&)p);t4u i=cNk;
while(i<(4*(cNr2+1))){tWU4 lT=((tWU4*)this)[i-1];
if(i%cNk==0){
#ifdef eAEB
lT=(tWU4)__xI(lT,8);
#else
lT=(tWU4)__xR(lT,8);
#endif
lT=_x_SBxA(lT);((tWU1*)&lT)[0]^=cRcn[i/cNk];}
ig(/*cNk>6&&*/i%cNk==4){lT=_x_SBxA(lT);}
((tWU4*)this)[i]=((tWU4 const*)this)[i-cNk]^lT;++i;}
i=15;while(i--){m[i]=_x_Tp(m[i]);}}

rSt rKx tWU1 _q_BF(tAEB const&p)rEp{rRt((tWU1 const*)&p)[0x0F];}
rSt rKx tWU4 _q_4(tAEB const&q,t1u p)rEp{rRt((tWU4 const*)&q)[p];}
rSt voi _w_4(tAEB&q,t1u p,tWU4 r)rEp{((tWU4*)&q)[p]=r;}
rSt voi _x_ShRwA(tAEB&p){
p.m.u.m1=_x_SBxA(p.m.u.m1),p.m.u.m2=_x_SBxA(p.m.u.m2),
p.m.u.m3=_x_SBxA(p.m.u.m3),p.m.u.m4=_x_SBxA(p.m.u.m4);
#ifdef eAEB
_w_4(p,1,(tWU4)__xI((t4u)_q_4(p,1),0x08)),
_w_4(p,2,(tWU4)__xI((t4u)_q_4(p,2),0x10)),
_w_4(p,3,(tWU4)__xI((t4u)_q_4(p,3),0x18));
#else
_w_4(p,1,(tWU4)__xR((t4u)_q_4(p,1),0x08)),
_w_4(p,2,(tWU4)__xR((t4u)_q_4(p,2),0x10)),
_w_4(p,3,(tWU4)__xR((t4u)_q_4(p,3),0x18));
#endif
}
rSt voi _x_ShRwB(tAEB&p){
#ifdef eAEB
_w_4(p,1,(tWU4)__xR((t4u)_q_4(p,1),0x08)),
_w_4(p,2,(tWU4)__xR((t4u)_q_4(p,2),0x10)),
_w_4(p,3,(tWU4)__xR((t4u)_q_4(p,3),0x18)),
#else
_w_4(p,1,(tWU4)__xI((t4u)_q_4(p,1),0x08)),
_w_4(p,2,(tWU4)__xI((t4u)_q_4(p,2),0x10)),
_w_4(p,3,(tWU4)__xI((t4u)_q_4(p,3),0x18)),
#endif
p.m.u.m1=_x_SBxB(p.m.u.m1),p.m.u.m2=_x_SBxB(p.m.u.m2),
p.m.u.m3=_x_SBxB(p.m.u.m3),p.m.u.m4=_x_SBxB(p.m.u.m4);}


rSt rKx tWU4 _x_XO(tWU4 a,tWU4 b,tWU4 c,tWU4 d)rEp{rRt a^b^c^d;}
rSt voi _x_MxCoA(tAEB&p){tWU4 A=_q_4(p,0),B=_q_4(p,1),C=_q_4(p,2),D=_q_4(p,3),l=_x_XO(A,B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&I,0x10);}t1u const R=N&0x0F;t1u const P=0x10-R;std::memset(R+(t1u*)&I,P,P);A(I,O);try{q.uRi_h(&O,0x10);}rFV{throw __cIO;}}
voi tAEP::B_h(tFi const&p,tFi&q)rKV{tAEB I,O;t4u N=(t4u)p.kRd(&I,0x10);for(;;){B(I,O);N=(t4u)p.kRd(&I,0x10);if(N){try{q.uRi_h(&O,0x10);}rFV{throw __cIO;}}ih{break;}}try{q.uRi_h(&O,0x10-_q_BF(O));}rFV{throw __cIO;}}

#if 0
int main_encrypt(){
tFi lRd,lRi;
tAEP lAEP(tAEK::cKy);
if(tFi::xbb(*"GAGAGA")||tFi::xbb(*"GAGAGA.bin")){return 0;}
try{lRd.AWB_h(*"GAGAGA");}rFV{goto la1;}
try{lRi.AWB_h(*"GAGAGA.bin");}rFV{goto la2;}
try{lAEP.A_h(lRd,lRi);}rFV{goto la3;}
la3:
lRi.B();
la2:
lRd.B();
la1:
return 0;}
int main_decrypt(){
tFi lRd,lRi;
tAEP lAEP(tAEK::cKy);
if(tFi::xbb(*"GAGAGA")||tFi::xbb(*"GAGAGA.out")){return 0;}
try{lRd.AWB_h(*"GAGAGA");}rFV{goto la1;}
try{lRi.AWB_h(*"GAGAGA.out");}rFV{goto la2;}
try{lAEP.B_h(lRd,lRi);}rFV{goto la3;}
la3:
lRi.B();
la2:
lRd.B();
la1:
return 0;}
#endif

AAES.h


/*AAES.h*/
#pragma once
#include<QtWidgets/QComboBox>
#include<QtWidgets/QLabel>
#include<QtWidgets/QHBoxLayout>
#include<QtWidgets/QMainWindow>
class tMa:public QMainWindow{Q_OBJECT
public:
explicit tMa(QWidget* =0);
private slots:
void AE();
void BE();
void uTx(QString const&);
private:
QLabel*mLb1,*mLb2,*mLb3,*mLb4,*mLb5,*mLb6,*mLbNt;
QLineEdit*mLnEd;
std::string mTx;bool mbTx;};


AAES.cpp


/*AAES.cpp*/
#include<AAES.h>
#include<AAESP.h>
#include<QtWidgets/qapplication.h>
#include<QtWidgets/qpushbutton.h>
#include<QtWidgets/qfiledialog.h>
#include<QtWidgets/qlineedit.h>
#include<unistd.h>
/*You ANid to run   moc AAES.h -o AAES.moc  .
Firstly, 'cd' (change directory) to your header file (named "AWS.h"), then run "moc" to AGn AWS.moc.
For evry change you do to the header file, you ANid to regenerate this file named "AWS.moc".*/
#include"AAES.moc"
rSt tAEK nAEK;
rSt QRect _x_(t4s x,t4s y,t4u w,t4u h)rEp{rRt QRect(x-(t4s)(w>>1U),y-(t4s)(h>>1U),w,h);}
tMa::tMa(QWidget*p):QMainWindow(p){
this->setWindowTitle("AES crypter");
this->setGeometry(QRect(120,120,0x2B0,0x100));
{mLb1=new QLabel("Welcome to AES crypter!",this);mLb1->setFixedWidth(0x2B0),mLb1->move(0x10,0x0C0),mLb1->show();}
{mLb2=new QLabel("Result of operation is shown on this line, here.",this);mLb2->setFixedWidth(0x2B0),mLb2->move(0x10,0x0D0),mLb2->show();}
{QLabel*l=new QLabel("Copyleft R-Man 2014",this);l->setFixedWidth(0x2B0),l->move(0x10,0x0E0),l->show();}
{QPushButton*l=new QPushButton("Encrypt",this);l->setGeometry(_x_(0x180,0x018,0x50,0x20)),
QObject::connect(l,SIGNAL(clicked()),this,SLOT(AE())),l->show();}
{QPushButton*l=new QPushButton("Decrypt",this);l->setGeometry(_x_(0x220,0x018,0x50,0x20)),
QObject::connect(l,SIGNAL(clicked()),this,SLOT(BE())),l->show();}

{mLb3=new QLabel("Enter your 256-bit key:",this);mLb3->setFixedWidth(0x2B0),mLb3->move(0x20,0x034),mLb3->show();}
{mLb4=new QLabel("0x",this);mLb4->setFixedWidth(0x20),mLb4->move(0x10,0x058),mLb4->show();}
{mLb5=new QLabel("Fill-in only valid hexadecimal text",this);mLb5->setFixedWidth(0x280),mLb5->move(0x10,0x070),mLb5->show();}
{mLb6=new QLabel("64 / 64 characters",this);mLb6->setFixedWidth(0x0A0),mLb6->move(0x1E0,0x070),mLb6->show();}
QWidget*lWn=new QWidget(this);
lWn->setGeometry(QRect(0x020,0x50,0x280,0x30));
QHBoxLayout*lLy=new QHBoxLayout();
mTx="00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF";mbTx=1;
nAEK=tAEK(mTx.data());
mLnEd=new QLineEdit(QString(mTx.data()));
QObject::connect(mLnEd,SIGNAL(textChanged(QString const&)),this,SLOT(uTx(QString const&)));
lLy->addWidget(mLnEd);
lWn->setLayout(lLy);
lWn->show();}
void tMa::AE(){
if(!mbTx){
mLb1->setText(QString("Encrypting: FAIL")),
mLb2->setText(QString("Check key."));rRt;}

QString lFiIn=QFileDialog::getOpenFileName(this,tr("Open File"),"",tr("Files (*.*)"));
if(!lFiIn.length()){rRt;}
QString lFiOu=lFiIn+QString(".bin"),lFiR;
std::wstring
lA=lFiIn.toStdWString(),
lB=lFiOu.toStdWString();
tFi l,k;
tAEP lAEP(nAEK);bool R;
if(tFi::xbb(*lB.data())){R=0;lFiR="File already exists! Please firstly resolve.";goto la1;}
try{l.ARB_h(*lA.data());}rFV{R=0;lFiR="Now cannot open file! Something just changed?";goto la1;}
try{k.AWB_h(*lB.data());}rFV{R=0;lFiR="Cannot start writing file! I/O error?";goto la2;}
mLb1->setText(QString("Encrypting: Program will freeze for a while."));
mLb2->setText(QString("Please wait .."));
try{lAEP.A_h(l,k);R=1;}rFV{R=0;lFiR="Cannot write file during encrypting! I/O error?";}
k.B();
la2:
l.B();
la1:;
if(R){
mLb1->setText(QString("Encrypted: OK.")),mLb2->setText(QString("Output: ")+lFiOu);}
ih{
mLb1->setText(QString("Encrypting: FAIL .. !")),mLb2->setText(lFiR);}}
void tMa::BE(){
if(!mbTx){
mLb1->setText(QString("Decrypting: FAIL")),
mLb2->setText(QString("Check key."));rRt;}

QString lFiIn=QFileDialog::getOpenFileName(this,tr("Open File"),"",tr("Files (*.*)"));
if(!lFiIn.length()){rRt;}
QString lFiOu=lFiIn+QString(".out"),lFiR;
std::wstring
lA=lFiIn.toStdWString(),
lB=lFiOu.toStdWString();
mLb1->setText(lFiOu);
tFi l,k;
tAEP lAEP(nAEK);bool R;
if(tFi::xbb(*lB.data())){R=0;lFiR="File already exists! Please firstly resolve.";goto la1;}
try{l.ARB_h(*lA.data());}rFV{R=0;lFiR="Now cannot open file! Something just changed?";goto la1;}
try{k.AWB_h(*lB.data());}rFV{R=0;lFiR="Cannot start writing file! I/O error?";goto la2;}
mLb1->setText(QString("Decrypting: Program will freeze for a while."));
mLb2->setText(QString("Please wait .."));
try{lAEP.B_h(l,k);R=1;}rFV{R=0;lFiR="Cannot write file during decrypting! I/O error?";}
k.B();
la2:
l.B();
la1:;
if(R){
mLb1->setText(QString("Decrypted: OK.")),mLb2->setText(QString("Output: ")+lFiOu);}
ih{
mLb1->setText(QString("Decrypting: FAIL .. !")),mLb2->setText(lFiR);}}
void tMa::uTx(QString const&p){
/*t4u i=mTx.length();
if(i<0x40){t4u lDf=0x40-i;std::string lS2;while(lDf--){lS2+="0";}mTx=lS2+mTx;}
ig(0x40<i){mTx=std::string(mTx,0,0x40);}
for(i=0;i<0x40;++i){
if(0x60<mTx[i]&&mTx[i]<0x67){mTx[i]^=0x20;}
if(!((0x2F<mTx[i]&&mTx[i]<0x3A)||(0x40<mTx[i]&&mTx[i]<0x47))){mTx[i]=0x48;}}*/
mTx=p.toStdString();
t4u i=mTx.length();
if(i!=0x40){goto laEr;}
for(i=0;i<0x40;++i){
if(((0x2F<mTx[i]&&mTx[i]<0x3A)||(0x40<mTx[i]&&mTx[i]<0x47))){}
ig(0x60<mTx[i]&&mTx[i]<0x67){mTx[i]|=~0x20;}
ih{goto laEr;}}
nAEK=tAEK(mTx.data());
mbTx=1,mLb5->setText("The text for the key is valid. :-D"),mLb6->setText(QString("64 / 64 characters  [OK]"));
rRt;laEr:
QString lS3;lS3.setNum(i,10);
mbTx=0,mLb5->setText("The text for the key is invalid .. o_O"),mLb6->setText(lS3+QString(" / 64 characters"));}
t4s main(t4s argc,t1k*argv[]){
QApplication lAp(argc,argv);
tMa l;l.show();
rRt lAp.exec();}


Screenshots:









No comments:

Post a Comment