Você está na página 1de 183

A. E. S.

ABSTR AC T

The

re p or t

de a l s

wi t h

AE S

a l go ri t h m

and

p ro po se s

t he

opt i mi z e d mode o f i mp l e me n t i n g t he s a me . Va ri o u s sce n a ri o s ha ve be e n di sc u s se d f or i mp l e me n t a t i on s o f t he AE S a l go ri t h m. The s e c o mp ri se o f a n u mb e r o f mode s o f o pe ra t i on, e. g. CBC, ECB, a nd ICBC, i n c o mbi na t i o n wi t h mul t i t h re a de d a nd no n t h re a de d a rc hi t e c t u re s. The f i r s t a l go r i t h m a rc hi t ec t u re i s t h e i mp l e me n t a t i o n un de r ECB ( El e c t ro n i c Co d e Boo k ) mode . Th e se c o nd a rc hi t e c t u re i s t he i mpl e me n t a t i o n i n CBC ( Ci p h e r Bl oc k Ch a i n i n g) mo de . The a bo ve di sc u s s e d mode s a r e a l s o i mp l e me n t e d u si n g mul t i- t hre a di n g. Ne x t i s t he mul t i- t hre a de d ve r s i on o f ICBC ( Int e r l e a ve d Ci p he r Bl o c k Cha i ni n g) mode . I n t hi s mode f i r s t t hr e a d a c t s on t h e f i r s t b l oc k wi t h a n Ini t i a l Ve c t o r IV1 , t h e se c o n d t h re a d a c t s o n t he se c ond b l oc k wi t h a not he r Ini t i a l Ve c t or IV2 , a n d s o on. The o u t p u t o f t he fi r s t bl oc k a c t s a s t he i npu t f or N+ 1t h bl oc k, whe re N i s t he n u mbe r of t h re a d s u se d. The se mo de s ha ve be e n i mp l e me n t e d a n d t e st e d f or va ri o u s n u mbe rs o f t hre a d s. The b e ha vi o r o f t h e c ode , w. r. t . e xe c ut i o n t i me , ha s b e e n sc r u t i ni z e d fo r va ri ou s t h re a d s e . g. 2, 3, 6, 9 , 10, 1 6, 20 n more , e a c h t h re a d wi t h va ri ou s fi l e si z e d i np u t s, ra n gi n g fr o m 10 0 KB t o 2 M Bs. We c onc l u d e a nd z e r o i n on t h e be s t po s si b l e a ppr oa c h fo r i mpl e me n t i n g t h e AE S a l g o ri t h m, in t e r ms Th e of me mo r y r e qu i r e me nt of and all pe r fo r ma nc e i s s u e s. me mo ry re q u i r e me nt

A. E. S. a rc h i t e c t u re s i s p re se nt e d i n t he c onc l u si on. Th e p l a t fo r m u se d fo r a l l t he i mpl e me n t a t i o n i s J AV A 2. The c o de s h a ve be e n de ve l ope d a nd t e s t e d o n 32 bi t , x8 6 p ro c e s s or s, In t e l HT P r oc e s so r s. The a pp l i c a t i on ha s be e n t e s t e d on LI NU X a nd WIN D OWS e n vi r on me n t .


Te c h n i c a l S p e c i fi c a ti o n

The Ad va nc e d Enc ry pt i o n St a n d a rd ( AE S) spe c i f i e s a NI STa pp ro ve d c ry p t o gra p hi c a l g o ri t h m t ha t c a n be u se d t o p ro t e c t e l e c t ro ni c da t a . The AES a l g o ri t h m i s a sy mme t ri c bl oc k c i ph e r t ha t c a n e nc r y pt (e n c i p h e r) a nd d e c ry pt (de c i p he r ) i n f or ma t i on. Enc r y pt i o n c on ve rt s da t a t o a n u n i n t e l l i gi bl e fo r m c a l l e d c i phe r t e xt ; d e c ryp t i n g t h e c i phe r t e x t c o n ve rt s t he da t a ba c k i n t o i t s or i gi na l fo r m, c a l l e d p l a i nt e xt . The AES a l g or i t h m i s c a pa bl e o f us i n g c r ypt o gra ph i c ke y s o f 128, 1 9 2, a n d 2 5 6 bi t s t o e n c r ypt a n d de c ryp t d a t a i n bl oc ks o f 128 b i t s. J AV A i s a p l a t e fo r m i nd e p e nde n t l a n gua ge a n d i t of fe r s a n e ff i c i e n t a nd o pt i mi z e d me t ho d s t o i mp l e me n t AE S

A. E. S.

TABLE OF C ON TEN TS

C H A P T E R N O.

TIT L E ABST RACT LIST OF T ABL E LIST OF FIGURES LIST OF S YMB O LS

P A G E N O. 1 6 7

9 10
10 11 13 13 14 14 14 16 18 18

1
1. 1 1. 2

INT RODU CT IO N S YMMETR IC KE Y C R YPT OGR AP HY VAR I OUS BLOC K C IP HER T EC HNIQUES 1. 2. 1 F I E S T A L C I P H E R 1. 2. 2 D E S 1. 2. 3 T Y P E S O F A T T A C K O N D E S 1. 2. 4 T R I P L E D E S 1. 2. 5 A E S 1. 2. 6 S T R E N G H T O F A E S 1. 2. 7 M U L T I T H R E A D I N G

PRE VIOUS WORK 2. 1 B L O C K C I P H E R 2. 2 A T T A C K O N B L O C K C I P H E R S 2. 2. 1 B I R T H D A Y A T T A C K 2. 2. 2 B R UT E F O R C E A T T A C K 2. 2. 3 W E A K K E Y 2. 2. 4 M E E T I N T H E M I D D L E

19 20 20 21 22

2 . 3 A. E . S

A. E. S. 3
PROPOSE D WORK 3. 1 B L O C K C I P H E R M O D E S O F O P E R AT I O N 3. 1. 1 E C B 3. 1. 2 C B C 3. 2 S O F T W A R E R E Q U I R E M E N T S P E C I F I C A T I O N 3. 2. 1 I N T R O D U C T I O N 3. 2. 2 U S A G E S C E N A R I O 28 29 24 26 24

3. 2. 3 S O F T W A R E I N T E R F A C E D E S C R I P T I O N 3 0 3. 2. 4 R E S T R I C T I O N S , L I M I T AT I O N S 3. 3 S O F T W A R E D E S I G N S P E C I F I CA T I O N 3. 3. 1 I N T R O D U C T I O N 3. 3. 2 D A T A D E S I G N 3. 3. 3 C O M P O N E N T L E V E LD E S I G N 3. 3. 3. 1 P R O G R A M S T R U C T U R E 3. 3. 3. 2 A R C H I T E C T U R ED I A G R A M 3. 3. 3. 3S O F T W A R E I N T E R F A C E 3. 3. 4 U S E R I N T E R F A C E D E S I G N 3. 4 F UNCT IONS DES CR IPT ION 3. 4 1. D E C R Y P T I O N F U N C T I O N 3. 4. 2 E N C R Y P T I O N F U N C T I O N 3. 5 M O D U L E W I S E D E S C R I P T I O N 3. 5. 1 I N P UT S A N D O U T P U T 3. 5. 2. S U B - B Y T E S T R A N S F O R M A T I O N 3. 5. 3 S H I F T R O W T R A N S F O R M A T I O N 3. 5. 4 A D D R O U N D K E Y 3. 5. 5 K E Y E X P A N S I O N 40 41 42 42 42 43 44 45 31 32 33 34 34 38 39 31

A. E. S.
3. 6 DES IGN 3. 6. 1 S O F T W A R E A R C H I T E C T U R E 3. 6. 2 A C T I V I T Y D I A G R A M 3. 6. 3. S E Q U E N C E D A I G R A M 3. 6. 4 F UNCT IONAL BLOC K DI AGR AM 48 49 50 51 54 55 56 58 62

3. 6. 5 S T AT E T R A N S I T I O N D I A G R A M 3. 6. 6 F O R M

4 5 6 7

RES UL T AND ANAL YSIS CONCL US ION FUT URE WORK APPE NDICE S 7. 1 A B O U T J A V A 7. 2 M A T H E M AT I C A L D E S C R I P I T O N 7. 3 C O D I N G 7. 4 T E S T C A S E S

64 67 83 160

8 9

RE FRE RE NCE S BIO DAT A OF ME MB E RS

181 183

A. E. S.

LIST OF TA BLES

S . N O.

TABL E NAME

P A G E N O.

CIP HER ENC R YPT

76

INVERS E C IP HER DEC R YPT

78

EQUI VALENT INVERS E C IP HER DECR YPT

80

A. E. S.

LIST OF FI GURES

SNO.

F IGURE N AM E

P AGE NO.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

FIEST AL CIP HER ECB ENCRYP TI ON M ODE ECB DECRYP TI ON M ODE IM AGE ENCRYP TI ON US ING E. C. B CBC ENCRYP TI ON M ODE CBC DECRYP TI O N M ODE ARCH I TECTUR E DI AGR AM INTERF ACE DECRYP TI ON F UNCT ION ENCRYP TIO N F UN CT I ON BYTE SUB SHIF T ROWS TR AN SF ORM AT ION ADD ROUND KEY KEY EXP AN SI ON ACTIV ITY DI AGR AM

12 24 25 25 26 27 34 39 40 41 43 44 45 47 49 7

16 17 18 19 20 21 22 23 24 25 26

SEQUENCE DI AGR AM FUNCTI ON AL BLO CK DI AGR AM STATE T RAN S ITI ON DI AGR AM AN ALY S I S OF THE P ROJ ECT ICBC ENCRYP TI ON AND DECRYP TIO N I N ECB ECB M ULT I- THRE ADE D ENCRYP TI ON ECB M ULT I- THRE ADE D DECRYP TI ON CBC ENCRYP T ION CBC DECRYP T ION CBC M U LTI- THRE ADE D DECRYP TI ON

A. E. S. 50 51 54 56 63 67 67 68 69 70 71

A. E. S.

LIST OF SYM BOLS

S. NO

SYM BO LS

P AGE NO.

EK , M, E K - 1

19

C, P, E K 1 , E K 2

22

Nb, Nk, Nr, Rc on

73

Put Byt e s, Pr i n t , Cop y , He x

75

5 .

Ge tByt e

76

A. E. S.

CHAP TER 1

INTRODU CTI ON

Cry pt o gra p hy i s t he p ra c t i c e a n d s t u d y of hi di n g i n fo r ma t i on . In mod e rn t i me s c ry pt o gra p hy i s c on si d e re d a bra nc h o f bo t h ma t he ma t i c s a n d c o mpu t e r wi t h i n fo r ma t i o n sc ie nc e a nd is a f fi l i a t e d closely t he or y, c o mpu t e r se c u ri t y a n d e n gi n e e r i n g.

Cry pt o gra p hy i s u s e d i n a p pl i c a t i on s p re se n t i n t e c hno l o gi c a l l y a d va n c e d s oc i e t i e s; e xa mp l e s i n c l ud e t he se c u ri t y of AT M c a rd s , c o mp u t e r p a s s wor d s a n d e l e c t r on i c c o mme rc e whi c h a l l de pe n d o n c r yp t o gra phy.


S y m me t r i c - k e y c r y p t o g r a p h y re f e r s t o e n c r y pt i o n me t ho d s i n

whi c h b o t h t h e se nde r a nd re c e i v e r s ha re t he sa me ke y. Th e st ud y of sy m me t ri c- ke y c i phe r s re l a t e s ma i n l y t o t he st ud y of b l o c k c i p he r s a nd s t re a m c i p he r s a n d t o t he i r a p pl i c a t i o n s. A bl oc k c i phe r t a ke a s i n pu t a b l oc k o f pl a i n t e x t a nd a ke y, a n d out pu t a b l oc k o f c i phe rt e xt o f t he sa me s i z e . Si nce me s sa ge s a re a l mo st a l wa y s l o n ge r t ha n a s i n g l e b l o c k, s o me me t h od o f kni t t i n g t o ge t he r s uc c e s si v e b l oc k s a re re q u i re d. The go a l of c r yp t a na l y si s is to find s o me we a kne s s or

i n se c u r i t y i n a c ry p t o gr a p h i c s c he me , s u b ve r si on o r e va si o n.

t h u s pe r mi t t i n g i t s

The re a re a wi de va r i e t y of c ryp t a na l yt i c a t t a c k s , a n d t he y c a n be c l a s si fi e d i n a n y of se ve ra l wa y s. A c o mmo n di st i nc t i o n 10

A. E. S. t u rn s o n wh a t a n a t t a c ke r kn o ws a n d wh a t c a pa b i l i t i e s a r e a va i l a b l e . In a c i p h e rt e xt -o n l y a t t a c k, t he c r yp t a na l y st ha s a c c e s s o n l y t o t he c i p h e r t e x t . In a kno wn - p l a i nt e xt a t t a c k, t h e c ry p t a n a l y st ha s a c c e s s t o a c i p h e rt e xt a n d i t s c o rr e spo nd i n g pl a i nt e xt . In a c h o se n - p l a i nt e xt a t t a c k, t he c ry pt a na l y st ma y c hoo se a pl a i n t e x t a n d l e a r n i ts c o r re sp o n di n g c i p he r t e x t . Fi na l l y, i n a c ho se n -c i phe rt e xt a t t a c k, t he c ry pt a na l y st ma y be a bl e t o c h oo se c i p he r t e x t s a nd l e a rn their c o rre s po ndi n g pl a i nt e xt s.

V A R I O U S B LO C K C I P H E R T E C H N I Q U E S

FIESTEL CIPHERS

The diagram shows the general design of a Feistel cipher, a scheme used by almost all modern block ciphers. The input is broken into two equal size blocks, generally called left (L) and right (R), which are then repeatedly cycled through the algorithm. At each cycle, a hash function (f) is applied to the right block and the key, and the result of the hash is XOR -ed into the left block. The blocks are then swapped. The XOR-ed result becomes the new right block and the unaltered right block becomes the left block. The process is then repeated a number of times.

11

A. E. S.

F IEST AL CIP HER The hash function is just a bit scrambler. The correct operation of the alg orithm is not based on any property of the hash function, other than it be completely deterministic; i.e, if it's run again with the exact same inputs, identical output will be produced. To decrypt, the ciphertext is broken into L and R blocks, and the key and the R block are run through the hash function to get the same hash result used in the last cycle of encryption; notice that the R block was unchanged in the last encryption cycle. The hash is then XOR'ed into the L block to reverse the last encryption cycle, and the process is repeated until all the encryption cycles have been backed out. The security of a Feistel cipher depends primarily on the key size and the irreversibility of the hash function. Ideally, the output of the hash function should appea r to be random bits from which nothing can be determined about the input(s).

12

A. E. S.
D A T A E N C R Y P T I O N S T A N D A R D ( D. E. S )

DES i s t h e b l oc k c i p h e r a n a l go ri t h m t ha t t a ke s a fi xe dl e n gt h s t r i n g of pl a i n t e x t bi t s a n d t ra n sf o r ms i t t h r ou gh a se r i e s of c o mpl i c a t e d ope ra t i o n s i nt o a n ot he r c i phe r t e x t b i t s t r i n g o f t he sa me l e n gt h. In t h e c a se o f DES, t he b l oc k s i z e i s 6 4 b i t s. DES a l so u se s a ke y t o c u s t o mi z e t he t ra n s f or ma t i o n, so t h a t de c r y p t i o n c a n sup po se d l y on l y be pe rf o r me d b y t h o se wh o kno w t h e pa rt i c u l a r ke y u se d t o e n c r yp t . The ke y o st e n s i b l y c on si s t s o f 6 4 bi t s; h o we ve r, on l y 56 of t he se a re a c t ua l l y u s e d by t he a l go ri t h m. Ei gh t b i t s a re u s e d s ol e l y fo r c he c ki n g p a r i t y , a nd a re t h e re a f t e r d i sc a rde d. He n c e t h e e ff e c t i ve ke y l e n gt h i s 56 b i t s, a n d i t i s u su a l l y q u ot e d a s suc h. The re a re t h r e e a t ta c k s kn o wn t ha t c a n b re a k t he fu l l s i x t e e n rou nd s of DES wi t h less c o mpl e x i t y t ha n a br u t e- fo rc e se a rc h : d i f fe re n t i a l c ry pt a na l y si s ( DC), l i n e a r

c ry p t a n a l y si s ( LC), a n d Da v i e s ' a t t a c k.
D i ffe r e n ti a l c r y p ta n a l y s i s : To bre a k t h e f ul l 16 r oun d s,

di ffe re nt i a l c ry pt a na l y si s re q ui re s 2 4 7 c h o se n p l a i n t e x t s. DE S wa s d e si gn e d t o be re s i st a n t t o DC.
L i ne a r c r y p t a n a l y si s ne e d s 2 4 3 kno wn p l a i n t e x t s. The re i s n o

e vi d e nc e t ha t DES wa s t a i l o re d t o b e re si s t a n t t o t hi s t yp e o f a t t a c k.
I mp r o v e d D a v i e s' a tt a c k : The mo st po we rf ul fo r m o f t h e

a t t a c k re qu i re s 2 5 0

kn o wn p l a i n t e x t

h a s a c o mp u t a t i o n a l

c o mp l e x i t y o f 2 5 0 , a n d ha s a 5 1% suc c e s s ra t e . 13

A. E. S.
TRIPLE DES

In Tr i p l e DES wi t h t hre e i n de p e n de nt ke y s h a s a ke y l e n gt h o f 168 bi t s ( t h re e 5 6- bi t DES ke y s) , but due t o t he mee t - i n- t h e mi d dl e a t t a c k t h e e f fe c t i ve se c u r i t y i t pr o vi de s i s on l y 1 1 2 bi t s. Ke y i n g o p t i o n 2, re duc e s t he ke y si z e t o 11 2 b i t s . Ho we ve r, t h i s o p t i o n i s s u sc e p t i b l e t o c e rt a i n c h o se n- pl a i n t e x t or kno wn- pl a i n t e x t a t t a c k s a nd t hu s i t i s de s i g na t e d by NI S T t o ha ve on l y 80 b i t s o f se c u r i t y.
AES

It h a s a fi xe d b l o c k si z e of 1 28 b i t s a nd a k e y si ze of 12 8, 192 , or 2 5 6 bi t s, wh e re a s Ri j n da e l c a n be s pe c i f i e d wi t h bl oc k a n d ke y s i z e s i n a ny mu l t i p l e o f 32 bi t s, wi t h a mi n i mu m o f 1 2 8 bi t s a nd a ma xi mu m of 256 bi t s. AES is fa st in b ot h so ft wa re a n d h a rd wa re , i s re l a t i ve l y e a s y t o i mpl e me n t , a n d re q u i re s l i t t l e me mo ry. Unl i ke i t s pre de c e ss o r DES, AES d oe s not us e a Fe i st e l ne t wo r k.

STRENGTH OF AES

A f e w fa c t s s hou l d be p oi n t e d o ut a bo ut t he s t re n gt h s o f 2- ke y a nd 3 - ke y TDES, e spe c i a l l y i n re l a t i o n t o t he st re n gt h o f AE S. In a pu re l y t h e ore t i c a l wa y , t he st re n gt h o f t he 3- ke y ve r s i on of TDES ma y be re d uc e d t o t h e s t r e n gt h o f t he 2 - ke y ve r s i on u si n g a me e t - i n- t he - mi d dl e a t t a c k. The re fo re , we ma y a s su me t h a t a TDE S ke y i s 112 b i t s a n d t he o nl y wa y t o a t t a c k a TDES ke y i s vi a a n e xh a u st i ve se a rc h.

14

A. E. S. In o r d e r t o i l l u st ra t e t h e st re n g t h o f 2- ke y TDES vi s - - vi s si n g l e ke y DES, a s su me t he fol l o w i n g: Su ppo se a DES Cra c k e r de vi c e c a n br e a k a si n gl e l e n gt h DE S ke y i n 24 ho ur s, t he n t he t i me t a ke n t o br e a k a 1 12 - b i t ke y o n t he sa me DES Cr a c ke r de v i c e wo ul d be a pp r oxi ma t e l y 200, 0 00, 000, 000, 000 ye a r s, l o n g e r t h a n t he l i fe t i me o f t h e kno wn u ni ve r s e a nd p ro ba bl y a ft e r t he so l a r s y st e m ha s be e n de vo ur e d b y a n e x pa n di n g su n. Pu t a no t he r wa y , i f we b ui l d a TDES Cra c ke r whi c h i s si mp l y 1, 000, 00 0 DES Cra c ke r s wo r ki n g in pa r a l l e l (c os t i n g a pp rox i ma t e l y $2 5 0, 0 0 0, 0 0 0, 0 0 0 US do l l a r s ), t he n i t wi l l st i l l t a ke ro u gh l y 20 0 mi l l i on ye a r s t o b re a k t h e ke y . Of c o u rs e a c o mp l e t e l y n e w t e c h ni que ma y b e de ve l o pe d t o a t t a c k TDES, but t he n wh o i s t o sa y t ha t AES w oul d no t a l s o be vul ne ra b l e t o suc h a n a t t a c k. The bo t t o m l i ne i s t h a t AE S a nd TDES (2 - ke y a nd 3- ke y ve r s i on s ) a re c u rre nt l y i n vu l n e ra b l e t o a t t a c k a n d a re l i ke l y t o re ma i n so fo r so me c on s i de ra bl e pe r i od of t i me . Th ere a re n o ob v i o us se c u ri t y re a son s f o r a n or ga ni z a t i on t o u p gra d e t he i r sy s t e ms f ro m TDES t o AE S a t t hi s t i me . F ur t h e r mo re , ma n y or g a ni z a t i on s i n t he b a n ki n g a n d f i na nc i a l a re a s a re i n t h e mi d dl e o f a n e xt re me l y e xpe n si ve p roj e c t to u p gra de fr o m DE S t o TDES a nd i t i s h i g h l y u n l i ke l y t ha t s uc h o r ga n i za t i o n s wi l l wri t e o ff t hi s i n ve s t me nt . F r o m a se c u r i t y pe r s p e c t i ve , t he re i s pl e n t y of t i me fo r o r ga ni z a t i on s t o mi g r a t e f ro m TDES t o AE S i n a c o nt ro l l e d a nd e f fi c i e n t ma n n e r.

15

A. E. S.
MULTITHRE ADING

A t h r e a d i n c o mpu t e r t wo or mor e

s c i e nc e i s

sh o r t (o r

f or

a t h re a d

of

e xe c u t i on. Th re a d s a re a wa y fo r a pr o gra m t o spl i t i t s e l f i nt o si mu l t a n e o u sl y Th re a d s a nd p se ud o - si mul t a n e ou s l y ) pr o c e s se s d i f fe r f ro m run ni n g t a s ks .

one o pe r a t i n g sy s t e m t o a n ot h e r bu t , i n ge ne ra l , a t h re a d i s c ont a i n e d i n si d e a p roc e s s a nd d i f fe re n t t h re a d s i n t he sa m e pro c e s s s ha re so me re s ou rc e s whi l e di ffe re nt p ro c e ss e s do n ot Mult ithreadin g gene rally occurs by ti me-di vi sion

multiplexing ("ti me sl icing") in ve ry much t he sa me wa y as t he parallel executi on of multiple tasks (computer mul tita skin g): the processor s witche s bet ween different threads. Thi s contex t switchi ng can si mu ltaneity whe rein happen to an so end t hreads fa st user. and as On to gi ve the i llusion of a multi proce ssor or mul tican run litera ll y

core syste m, th reading can be a chieved via multi proce ssi ng, different processes si mu ltaneou sly on different processors or core s. Th i s a d va nt a ge o f a mul t i t h r e a de d p ro gra m a l l o ws i t t o op e ra t e fa st e r o n c o mp ut e r s y st e ms t ha t h a ve mul t i p l e CP Us , CP U s wi t h mul t i pl e c o re s, o r a c ro s s a c l u st e r o f ma c hi ne s. Th i s i s be c a u se t he t h re a ds o f t h e p ro gra m na t u ra l l y l e n d t h e mse l ve s t o t r ul y c onc ur re nt e x e c u t i o n. In suc h a case, t he p ro gr a mme r ne e ds t o b e c a re fu l t o a voi d r a c e c o ndi t i o n s, a nd o t he r n o n- i n t u i t i ve b e ha v i o r s.

16

A. E. S. In o r de r f or d a t a t o b e c o r re c t l y m a n i p ul a t e d, t h rea d s wi l l of t e n ne e d t o re n de z vo u s i n t i me i n o r d e r t o pr oc e s s t he d a t a i n t he c or re c t o rde r. So me a d v a n t a ge s i n c l u d e :  If a t h re a d ge t s a l o t o f c a c he mi s se s, t he ot he r t hre a d (s ) c a n c o nt i nu e , t a ki n g a d va nt a ge o f t h e un u se d c o mpu t i n g re so urc e s, whi c h t h u s c a n l e a d t o fa st e r o ve ra l l e x e c u t i o n, a s t h e se re s ou rc e s wo ul d ha ve be e n i dl e i f o n l y a si n gl e t h re a d wa s e xe c ut e d.  If a t h re a d c a n n ot u se a l l t he c o mpu t i n g re so urc e s o f t h e CP U ( b e c a us e i n st ru c t i on s de pe n d on e a c h o t h e r ' s re su l t ), run ni n g a not he r t h re a d pe r mi t s t o not l e a ve t he se i dl e .  If se ve r a l t hre a d s wor k on t he sa me s e t o f da t a , t h e y c a n a c t u a l l y sha re i t s c a c h i n g, l e a di n g t o be t t e r c a che us a ge o r sy nc h ro ni z a t i on on i t s va l ue s.

17

A. E. S.

CHAP TER 2

PREVIOU S WORK

BLOCK CIPHER

In c r yp t o gra phy, a bl oc k c i p he r i s a sy m me t ri c ke y c i p h e r whi c h o pe ra t e s o n f i xe d - l e n gt h grou p s of bi t s, t e r me d bl oc ks , wi t h a n u n va ryi n g tra n sf or ma t i o n. Whe n e n c r ypt i n g, a bl oc k c i ph e r mi gh t t a k e (f or e xa mp l e ) a 1 28 - b i t bl oc k of pl a i n t e x t a s i np ut , a n d ou t pu t a c or re s p on d i n g 128- bi t bl oc k o f c i ph e rt e xt . The e x a c t t ra n sf or ma t i o n i s c on t r ol l e d u si n g a s e c o nd i n pu t t he s e c re t ke y . De c ry p t i o n i s si mi l a r : t h e de c ry pt i o n a l go r i t h m t a ke s, i n t hi s e xa mpl e , a 1 28 -bi t bl oc k of c i phe r t ex t t o ge t he r wi t h t h e s e c r e t ke y, a n d y i e l d s t h e o ri gi na l 1 28- b i t b l oc k o f pl a i nt e xt . To e nc ry pt me s s a ge s l o n ge r t ha n t he b l oc k s i z e (1 2 8 b i t s i n t he a bo v e e xa mp l e ), a mod e of o pe ra t i on i s u se d. Bl oc k c i p h e r s c a n be c o n t ra st e d wi t h s t re a m c i phe r s; a s t re a m c i ph e r op e ra t e s on i n d i v i d ua l d i g i t s on e a t a t i me , a nd t h e t ra n sf or ma t i o n v a r i e s du ri n g t h e e nc ryp t i on. The d i st i nc t i o n be t we e n t he t wo t ype s i s n ot a l wa y s c l e a r - c ut : a b l oc k c i p he r , whe n u s e d i n c e r t a i n mod e s o f o p e ra t i o n , a c t s e ffe ct i ve l y a s a st re a m c i p he r. A bl oc k c i p he r c o n si s t s o f t wo pa i re d a l go ri t h ms, o ne fo r e nc r y p t i o n, E, a n d a not he r fo r d e c ryp t i on , E- 1. Bot h a l go ri t h m s a c c e pt t wo i n p ut s: a n i n p ut b l oc k o f s i ze n b i t s a nd a ke y o f 18

A. E. S. si z e k b i t s, y i e l d i n g a n n- bi t o ut put b l oc k. Fo r a ny one fi x e d ke y, de c ry p t i o n i s t h e i n ve r s e fu nc t i o n o f e nc ry pt i on, so t ha t for a ny b l oc k M a n d ke y K. Fo r e a c h ke y K, EK i s a pe r mu t a t i on (a bi j e c t i ve mapp i n g) o v e r t he se t of i np u t bl o c ks. Ea c h ke y se l e c t s o ne p e r mu t a t i on f ro m t he p o s si b l e se t of 2 n !. The b l oc k s i z e , n, i s t yp i c a l l y 6 4 o r 12 8 b i t s, a l t h o u gh s o me c i ph e r s ha ve a va ri a bl e b l o c k si z e . 64 b i t s wa s t h e mo s t c o mmo n l e n gt h u nt i l t he mi d- 19 9 0 s, wh e n ne w d e si gn s be ga n t o s wi t c h t o t he l o n ge r 12 8- bi t l e n g t h. On e o f se ve ra l mo de s o f ope ra t i on i s ge ne ra l l y u s e d a l o n g wi t h a pa d di n g sch e me t o a l l o w pl a i n t e x t s o f a r b i t ra ry l e n g t h s t o be e n c r ypt e d. Ea c h mod e has di f fe r e nt c ha ra c t e ri st i c s in re ga r d to e rr o r pro pa ga t i on, e a se o f ra ndo m a c c e s s a n d vu l n e ra b i l i t y t o c e rt a i n t ype s of a t t a c k. Ty p i c a l ke y s i z e s ( k) i n c l u d e 4 0, 56, 6 4, 80 , 128, 1 92 a n d 2 5 6 bi t s. As o f 2 0 06 , 80 bi t s i s no r ma l l y t a k e n a s t he mi n i mu m ke y l e n g t h ne e de d t o pre v e nt br u t e fo rce a t t a c ks .

ATTACK ON BLOCK CIPHERS

B i r t h d a y a tt a c k

A b i r t h d a y a t ta c k i s a t yp e o f c r ypt o gra p hi c a t t a c k, s o n a me d be c a u se it e xp l oi t s t he ma t h e ma t i c s be h i n d t he bi rt hda y pro bl e m i n p ro ba b i l i t y t he o ry. Gi ve n a fun c t i on f, t h e goa l o f t he a t t a c k i s t o fi nd t wo i n p ut s x 1 , x 2 suc h t ha t f( x 1 ) = f ( x 2 ) . Suc h a pa i r x 1 ,x 2 i s c a l l e d a c o l l i s i on. The me t h o d u se d t o f i n d a c o l l i s i o n i s t o si mp l y e va l ua t e t h e fun c t i on f fo r di f fe re n t i np ut v a l u e s t h a t ma y b e c ho se n r a ndo ml y o r p se udo ra nd o ml y 19

A. E. S. unt i l t he sa me re s ul t i s f ou n d mo re t ha n o nc e . Be c a u se o f t h e a fo re me n t i one d b i r t h da y pr ob l e m t h i s me t h od c a n be ra t h e r e ff i c i e n t . Spe c i fi c a l l y, ou t p ut s if wi t h a func t i on f (x ) y i e l d s e qu a l p ro ba b i l i t y any of H d i ffe re nt and H i s the

su f fi c i e n t l y l a r ge , t he n we e x p e c t t o ob t a i n a pa i r of di ffe re n t a r gu me nt s x 1 a nd x 2 wi t h f ( x 1 ) fun c t i on fo r a b ou t = f (x 2 ) a ft e r e va l ua t i n g

di ff e re nt a r gu me n t s on a ve r a ge .

Br u t e fo r c e a t ta c k

In cryptanalysis,

a brute

force

attack is

method

of

defeating

a cryptographic scheme by systematically trying a large number of possibilities; for example, a large number of the possible keys in a key space in order to decrypt a message. In most schemes, the theoretical possibility of a brute force attack is recognized, but it is set up in such a way that it would be computationally infeasible to carry out. Accordingly, one definition of "breaking" a cryptographic scheme is to find a method faster than a brute force attack. The selection of an appropriate key length depends on the practical feasibility of performing a brute force attack. By obfuscating the data to be encoded, brute force attacks are made less effective as it is more difficult to determine when one has succeeded in breaking the code.

We a k ke y

In c ry pt o gr a ph y, a we a k ke y i s a k e y whi c h wh e n u se d wi t h a spe c i fi c c i p h e r, ma ke s t h e c i phe r be ha ve i n so me u nde s i ra bl e wa y. We a k ke y s u s ua l l y re p re se n t a ve ry s ma l l f ra c t i o n o f t h e 20

A. E. S. o ve ra l l ke y spa c e , whi c h u s ua l l y me a n s t ha t i f o ne ge ne r a t e s a ra n d o m ke y t o e nc r y p t a me s sa ge we a k k e y s a r e ve ry un l i ke l y to gi ve r i se to a se c u ri t y p r obl e m. Ne v e r t he l e s s, it is c on si de re d d e si ra bl e f or a c i p he r t o ha ve no we a k ke y s. A c i ph e r wi t h no we a k ke y s i s sa i d t o h a ve a fl a t, o r l i n e a r, ke y spa c e .

Me e t - i n- t h e - mi d d l e a t ta c k

The Meet-in-the-middle

attack is

a cryptographic attack

which,

like

the birthday attack, makes use of a space-time tradeoff. While the birthday attack attempts to find two values in the domain of a function that map to the same value in its range, the meet -in-the-middle attack attempts to find a value in each of the ranges and domains of the composition of two functions such that the forward mapping of one through the first function is the same as the inverse image of the other through the second function -- quite literally meeting in the middle of the composed function. It was first developed as an attack on an attempted expansion of a block cipher by Diffie and Hellman in 1977. When trying to improve the security of a block cipher, one might get the idea to simply use two independent keys to encrypt the data twice. Naively, one might think that this would square the security of the double-encryption scheme. Certainly, an exhaustive search of all possible combination of keys would take 22n attempts if each key is n bits long, compared to the 2n attempts required for a single key. Diffie and Hellman, however, devised a time-memory tradeoff that could break the scheme in only double the time to break the single -encryption scheme. [1] The attack works by encrypting from one end and decrypting from the other end, thus meeting in the middle. 21

A. E. S. Assume the attacker knows a set of plaintext and ciphertext: P and C. That is, , where E is the encryption function (cipher), and K1 and K2 are the two keys. The attacker can then compute EK(P) for all possible keys K and store the results in memory. Afterwards he can decrypt the ciphertext by computing DK(C) for each K. Any matches between these two resulting sets are likely to reveal the correct keys. (To speed up the comparison, the EK(P) set is stored in an in-memory lookup table, then each DK(C) can be matched against the values in the lookup table to find the candidate keys.) Once the matches are discovered, the y can be verified with a second test -set of plaintext and ciphertext. If the keysize is n, this attack uses only2n + 1encryptions (and O(2n) space) in contrast to the naive attack, which needs 22n encryptions (but only O(1) space).
AES

The Ad v a n c e d En c ryp t i on St a n da r d ( AES) i s a NIST s t a n da rd , F IP S 1 97 , s pe c i fy i n g a ne w sy m me t ri c e nc ry pt i o n a l go ri t h m. The AE S u se s a b l o c k si z e o f 1 2 8 bi t s (16 b y t e s ) a nd c a n b e use d wi t h ke y s i n l e n gt h s of 12 8, 192 or 25 6 b i t s. Ac c o rd i n g t o t he F IP S 19 7 doc u me nt , t hi s s t a n da r d ma y be u se d b y Fe de ra l de pa rt me n t s a n d a ge n c i e s whe n a n a ge nc y de t e r mi ne s t ha t se n s i t i ve use d by (u nc l a ss i fi e d ) non - Fe de ra l who f or i n fo r ma t i o n r e qu i r e s c r yp t o gra ph i c pro t e c t i on, a nd i n a d di t i on, t h i s st a nd a r d ma y be a d o pt e d a n d Go ve rn me n t and are bo t h o r ga n i z a t i on s. Tw o t he Ri j n da e l f ro m c r y p t o gra phe r s re se a rc he r s a l go r i t h m d e ve l o pe d s ub mi t t e d

c o n si d e ra t i on

Be l gi u m: Dr. J oa n Da e me n o f P r ot o n Wo rl d Int e rna t i on a l a n d Dr. Vi nc e nt Ri j me n . 22

A. E. S. The Na t i o na l In s t i t u t e o f St a nd a rd s a nd t e c h no l o gy ( NI ST ) se l e c t e d t he Ri j n d a e l a l g o ri t h m fo r AE S b e c a u se i t of fe r s a c o mb i n a t i on of se c u r i t y, p e r fo r ma nc e , e ff i c i e nc y, ea s e of i mp l e me n t a t i o n, a n d fl e xi b i l i t y. Spe c i f i c a l l y , Ri jn da e l a pp e a r s t o be c on si s t e n t l y a ve ry go od pe rf o r me r i n bo t h ha rd wa re a n d so ft wa re a c ro s s a wi de ra n g e of c o mp ut i n g e n vi ron me nt s It s The re ga rd l e s s o f i t s u se i n fe e db a c k or n o n - fe e db a c k mo de s. ke y se t up t i me i s e xc e l l e nt , a n d i t s ke y a g i l i t y i s goo d.

ve r y l o w me mo ry re q ui re me n t s o f t he Ri j nda e l a l go r i t h m ma ke i t ve ry we l l sui t e d fo r re st ri c t e d - spa c e e n vi ro n me nt s, i n wh i c h it a l so d e mon s t ra t e s excellent pe r fo r ma nc e . Th e Ri j n da e l a l go r i t h m o pe ra t i on s a re a mon g t he e a s i e st t o d e fe nd a ga i n s t po we r a n d t i mi n g a t t a c ks. de fe n se can be p ro vi d e d Add i t i ona l l y, i t a p pe a rs t ha t so m e a ga i n st suc h a t t a c ks wi t ho u t

si gn i f i c a n t l y i mpa c t i n g t he a l go ri t h m' s pe rf o r ma nc e.

23

A. E. S.

CHAPTER 3

PROPOSED WORK

B l oc k Ci p h e r M o d e s o f O p e r a ti o n

E l e c tr o n i c C o d e B o o k( E . C. B ) -

The simplest of the encryption modes is the electronic codebook (ECB) mode. The message is divided into blocks and each block is encrypted separately. The disadvantage of this method is that identical plaintext blocks are encrypted into identical ciphertext blocks; thus, it does not hide data patterns well. In some senses, it doesn't provide serious message confidentiality, and it is not recommended for use in cryptographic protocols at all.

24

A. E. S.

Here's a striking example of the degree to which ECB can leave plaintext data patterns in the ciphertext. A pixel -map version of the image on the left was encrypted with ECB mode to create the center ima ge:
IMAGE ENCRYPTION USING ECB

Ori gi na l

Enc r yp t e d u s i n g ECB mod e

Enc r ypt e d u s i n g ot he r mode s

The image on the right is how the image might look encrypted with CBC, CTR or any of the other more secure modes -- indistinguishable from random noise. Note that the random appearance of the image on the right tells us very little about whether the image has been securely encrypted; many kinds of insecure 25

A. E. S. encryption have been developed which would produce out put just as 'randomlooking'. ECB mode can also make protocols without integrity protection even more susceptible to replay attacks, since each block gets decrypted in exactly the same way. For example, the Phantasy Star Online: Blue Burst online video game uses Blowfish in ECB mode. Before the key exchange system was cracked leading to even easier methods, cheaters repeated encrypted "monster killed" message packets, each an encrypted Blowfish block, to illegitimately gain experience points quickly.

Cipher-Block Chaining (C.B.C.)

CBC mode of operation was invented by IBM in 1976. [1] In the cipher-block chaining (CBC) mode, each block of plaintext is XORed with the previous ciphertext block before being encrypted. Thi s way, each ciphertext block is dependent on all plaintext blocks processed up to that point. Also, to make each message unique, an initialization vector must be used in the first block.

26

A. E. S.

The e nc ry pt i on i n CBC mo de re q u i re s t he o ut p ut of t he f i r s t bl oc k a s t h e i np ut t o t he se c ond bl oc k. The re fo re whi l e t h re a d i n g t he e nc r y p t i o n pr oc e s s; t he se c on d b l oc k c a n n ot s t a r t i t s j o b, u nt i l t he fi r st bl oc k i s n o t fi n i she d. The t hi rd b l o c k c a nn o t s t a rt un t i l t h e se c on d i s n ot fi ni s h e d a nd so o n a n d s o fo rt h . Thu s su b se qu e n t bl oc k s c a nn ot be e n c ry pt e d si mu l t a ne o u sl y . Thi s e nt i re l y de fe a t s t he p u rp os e o f mu l t i t h re a d i n g, a s t he l a t e r a i ms a t e xe c u t i on of a l l t he t h re a d s si mu l t a ne o u sl y . The de c ry p t i o n c a n be d one i n a n ord e r su c h t ha t t h e o ut pu t o f t he f i r s t b l o c k i s no t re q ui re d f or t he de c ry pt i on o f se c on d . Th e de c r y p t i o n wa s h e nc e i mpl e me n t e d

27

A. E. S.
SOFTWARE REQUIREMENT SPECIFICATION

1. 0 I n t r o d u c ti o n Th i s s e c t i on pr o vi de s t he re q u i r e me n t doc u me n t a t i on.
G oa l s a n d O b je c t i v e s

The

p ro j e c t

a i ms

at

de ve l o pi n g

an

a pp l i c a t i on

to

i mp l e me n t t he AES e nc ry p t i on st a nd a rd a s spe c i fi e d i n t h e F IP S do c ume n t d a t e d 2 00 1 t h ro u gh M ul t i t h re a d i n g.

1.1

S t a t e me n t o f S c o p e

The sy s t e m wi l l be de si gne d t o r e a d t h e da t a f ro m a f i l e , t h rou gh a g i v e n pa t h a n d e nc r ypt t he da t a u si n g t h e sp e c i fi e d AES st a nda rd. The u se r s wi l l be a bl e t o u se t h e so ft wa re t o ke e p t he i r d a t a se c ur e fr o m e xt e r n a l i n t r ude r s a nd f o r ot he r fa c t o r s.

1 . 2 S o ft wa r e C o n t e x t The s o ft wa re a i ms a t t he pe o pl e a nd t he o r ga n i z a t i o n s wh o a re ke e n t o ke e p t h e i r da t a se c r e t a nd c o n fi de n t i a l . Th e ut i l i t y o f t he c o de i s t o p rot e c t t he da t a f r o m i n t ru de r s.

1.3 Major Constraints The sy s t e m wi l l be p l a t f or m i n d e pe n de n t fo r e xe c ut i o n,

but re qu i re s t he re s pe c t i ve J AV A En vi ro n me nt i n s t a l l e d a s t h e p re - r e qu i r e me n t .

28

A. E. S.
2.0

Usage scenario

This section provides a usage scenario for the software .


2.1 User profiles

The system does not provide the any specific user profiles. All the users are given the same amount of preference. All users will provide a path for the required file and the system will generate the output file as the encrypted or decrypted text, as requested by the user.
2.2 Use-cases

a ) U se r pr o v i de s t h e fi l e n a me a n d t h e fi l e p a t h.

Go a l : P ro vi d e t he s y st e m wi t h t he fi l e na me a nd f i l e p a t h. Pr i ma r y Ac t o rs : The u se r Se c o n da ry Ac t or s : Th e sy s t e m Pre c o n di t i o n: The u se r ha s a c c e s s t o t h e s y st e m. Po st c on di t i on : The sy s t e m ge t s t h e f i l e t o be o p e ra t e d u po n .

b ) U se r c h o o s e s b e t we e n E n c r y p ti o n a n d D e c r y p t i o n

Go a l : P ro v i d e t h e s y st e m wi t h hi s c hoi c e . Pr i ma r y Ac t o rs : The u se r Se c o n da ry Ac t or s : Th e sy s t e m

29

A. E. S. Pre c o n di t i o n: The u se r h a s pr o vi de d t he fi l e n a me an d fi l e pa t h. Po st c on di t i o n: Th e s y st e m n o w kno ws wha t t o d o wi t h t he re qu i re d fi l e .


2.3 Special usage considerations

The software can be available on all platforms. The application being a stand-alone application, the data cannot be modified while any user is retrieving the data.
3 . 0 S o ft wa r e I n te r fa c e De sc r i p t i o n 3 . 1 E x te r n a l ma c h i n e i n te r fa c e s

The ma i n so ft wa re mo du l e a n d t h e da t a c o nne c t i vi t y wi l l be p ro vi de d t hro u gh J AV A2 l a n g ua ge , u si n g J DK 1. 5 t oo l k i t .

3 . 2 E x te r n a l s y ste m i n te r fa c e s

The so f t wa r e mod ul e wi l l no t c o mmu n i c a t e wi t h a n y e x t e rna l sy s t e m. The s y st e m i s e nt i re l y de si gne d t o b e a s t a n d - a l o ne o ne.

3 . 3 H u ma n I n t e r fa c e

The s of t wa re wi l l n ot p ro v i d e muc h o f a hu ma n i nt e r fa c e . The e s se n c e o f t he i m pl e me n t a t i on i s t h e se c ur i t y re l a t e d i s s ue s ra t he r any and i n t e r fa c e d e s i gn i s sue s. 30

A. E. S.
4 . 0 Re s tr i c ti o n s, L i mi ta ti o n s a n d c o n s t r a i n t s

The so ft wa r e p a c ka ge wi l l b e a s t a n d- a l o ne a p p l i c a t i o n wi t ho ut a n y a c c e s s by ou t si d e e nt i t y. It i s p l a t fo r m i n de pe n de n t bu t ne e ds sp e c i fi c Ja va e n vi ro n me n t s fo r re spe c t i ve p l a t fo r ms.

SOFTWARE DESIGN SPECIFICATION

1 . 0 I n t r o d u c ti o n

Th i s s e c t i on pr o vi de s t he De s i gn do c u me nt a t i o n.
G oa l s a n d O b je c t i v e s

The p ro j e c t a i ms a t de ve l o pi n g a n a pp l i c a t i on t o i mp l e me n t t he AES e nc ry p t i on st a nd a rd a s spe c i fi e d i n t h e F IP S do c u me n t da t e d 2 001 t h ro u gh M u l t i t h re a d i n g.

1.4

S t a t e me n t o f S c o p e

The sy s t e m wi l l be de si gne d t o r e a d t h e da t a f ro m a f i l e , t h rou gh a g i v e n pa t h a n d e nc r ypt t he da t a u si n g t h e sp e c i fi e d AES st a nda rd. The u se r s wi l l be a bl e t o u se t h e so ft wa re t o ke e p t he i r d a t a se c u r e fr o m e xt e r na l i n t r ud e r s a nd f o r ot he r fa c t o r s.


1.5 S o ft wa r e C o n t e x t

The s o ft wa re a i ms a t t he pe o pl e a nd t he o r ga n i z a t i o n s wh o a re ke e n t o ke e p t h e i r da t a se c r e t a nd c o n fi de n t i a l . Th e ut i l i t y o f t he c o de i s t o p rot e c t t he da t a f r o m i n t ru de r s.

31

A. E. S.
1.6 Major Constraints

The sy s t e m wi l l be p l a t f or m i n d e pe n de n t fo r e xe c ut i o n, but re qu i re s t he re s pe c t i ve J AV A En vi ro n me nt i n s t a l l e d a s t h e p re - r e qu i r e me n t .
2 . 0 Da ta D e si g n

This section provides with the information regarding all data structures including internal, global, and temporary data structures.
2 . 1 I n t e r n a l S o ft wa r e d a ta st r uc t u r e

The de s i gne d so ft wa re wi l l be t ot a l l y Obj e c t Or i e n t e d , pro gr a mme d i n J AV A. Th i s wi l l b e a c hi e ve d by t he u se o f Ja va De ve l op me n t Ki t . Th e re l e v a nt da t a s t r uc t u re s h a v e t o u s e d. Pr i ma r i l y t he st ruc t u re s l i ke a r ra y s wi l l b e u se d. The y a re sc op e - s pe c i fi c . Ext e n si ve u se o f f i l e- ha n dl i n g wi l l a l s o b e d on e .


2 . 2 G l o b a l Da ta S t r uc t u r e

The sy s t e m wi l l be t o t a l l y o bj e c t -o ri e n t e d a nd he n ce wi l l not u se a n y gl o ba l o bj e c t s. Th e d a t a whi c h i s t o be ma d e a va i l a b l e t hr o u gh o ut t he i mpl e me nt a t i o n wi l l be re a d f ro m t h e re spe c t i ve f i l e s.


2 . 3 Te mp o r a r y Da ta S tr u c t u r e

The so ft wa re wi l l u se t he a r ra y s a s t he t e mpo ra ry da t a st ru c t u re s t o s t o re t he i nt e r i m s t a t e s o f t he da t a whi c h i s be i n g e n c ry pt e d or d e c ry pt e d.

32

A. E. S.
2 . 4 Da ta b a s e de sc r i p t i o n

The a c t u a l f i l e , wh i c h c on t a i ns t h e d a t a t o b e e n c rypt e d, a c t s a s t h e a va i l a bl e d a t a b a s e t h rou gh ou t t h e ope rat i o n. Th i s fi l e c on t a i n s t he da t a i n s i mpl e a l ph a- n u me r i c f or m a nd f e e d s t he i mp l e me nt a t i on wi t h t he sa me .


3.0

Component-Level Design

The software will be a stand-alone application and will be developed on the JAVA platform using the JDK tool-kit. Hence the main components of the software contain the modules in the form of objects. The main module will be directly linked with these objects and the relevant objects are instantiated and the methods invoked as and when required.
3.1 Program Structure

As the implementation is done is JAVA, the required objects will be created and then their methods are put to use w herever required. The modules will interact with each other whenever required and share the data among them. The code will be sequential in nature, i.e. all the modules would be executed in a certain order sometime or the other, irrespective of any event taking pace at the console.

33

A. E. S.
3. 2

Architecture D ia gram
Ma i n Mo du l e

De c r yp t i o n 10 Ro un d s Ac c e p t Te x t

E or D

Enc r ypt i o n 10

Ci p h e r Te x t

Pl a i n Te x t

Ac c e p t Te x t

Ac c e p t Ke y

Ke y

Ke y

Ac c e p t Ke y

De c r yp t e d Cod e

Enc r ypt e d Code

3 . 2 . 1 P r oc e ss i n g n a r r a t i v e fo r c o m p o n e n t 1

The fi r st c o mp o ne n t i s t he modu l e t o a s k t he u se r wh e t h e r he wa n t s t o e nc ry pt a p l a i n t e xt fi l e o r de c ry pt a c i p h e r t e x t . Al so i t wi l l p r o mpt t h e u s e r fo r t h e f ul l p a t h of t h e fi l e .

3.2.1.1

C o m p o n e n t 1 i n t e r fa c e d e sc r i p t i o n

Input:

Cho i c e

be t we e n

En c ry pt i on

or

De c r yp t i o n. F ul l Pa t h o f t he f i l e t o be ope ra t e d u pon.

34

A. E. S.
O u t p u t : The Ci p he r/ De c i phe r mo dul e . 3.2.1.2 C o m p o n e n t 1 P r o c e s si n g De t a il

A d e t a i l e d a l go r i t h mi c d e sc ri pt i on of ma i n mo du l e .
3 . 2 . 1 . 2 . 1 I n te r fa c e De sc r i p t i o n

The ma i n mod ul e p ro mp t s t he u se r t o e nt e r hi s choice be t we e n mod u l e ma ki n g t he t he ru n ni n g t he de c r yp t i o n a nd t he e nc r ypt i o n a p pro p ri a t e

mo d ul e . Af t e r

c ho i c e t he u s e r i s a s ke d t o e nt e r t he fu l l pa t h n a me of t h e re q ui re d fi l e .

3 . 2 . 1 . 2 . 2 A l g o r i t h mi c M o d e l

St e p 1: Ge t u se r s c h oi c e . St e p 2: Ge t t h e f i l e n a me a n d pa t h o f t h e fi l e t o be a c c e s se d. St e p 3: P roc e e d t o t he n e x t mo du l e .
3 . 2 . 1 . 2 . 3 R e s tr i c ti o n s / L i mi ta ti o n s

The u se r ha s t o pr o vi de t he fu l l fi l e p a t h na me be fo re p roc e e d i n g fo r the a c t ua l e nc r yp t i o n o r d e c ry pt i o n. Th e u s e r n e e d s t o t ype i n t h e wh ol e p a t h. 35

A. E. S.
3 . 2 . 1 . 2 . 4 L o c a l Da ta S t r uc t u r e s

The fi l e na me a nd t h e c h oi c e o f t h e u se r a re p re fe r a b l y st ore d i n s t r i n gs.


3 . 2 . 2 P r o c e s si n g n a r r a t i v e fo r c o m p o n e nt 2

The se c on d c o mpo ne n t a c c e p t s t h e ke y a nd t he t e xt , g e ne ra t e s t he S- b oxe s a n d t he re q ui re d r ou n d s fo r t h e e n c r yp t i o n p ro c e s s, d e p e nd i n g u p on t he si z e o f t he k e y, a n d pr o d uc e s t he ou t p ut t e x t .

3. 2. 2. 1 C o m p o n e n t 1 i n te r fa c e de s c r i p t i o n

In p u t : The e nc ry pt i o n ke y a n d t h e t e x t f ro m t h e f i l e . Output:

Th e Ci p he r / De c i p h e r t e x t .
3.2.2.2 C o m p o n e n t 2 P r o c e s si n g De t a i l

de t a i l e d

a l gor i t h mi c

d e sc r i pt i on

of

the

c i ph e r / de c i p h e r mo du l e .
3 . 2 . 2 . 2 . 1 I n te r fa c e De sc r i p t i o n

Th i s mod ul e a c c e p t s t he t e x t fr o m t he fi l e a nd ke y s re q ui re d fo r the a p p ro p ri a t e pro c e s s. 36

A. E. S. Af t e r r e a d i n g t he fi l e s, t he mod u l e doe s t he c i p h e r i n re qu i r e d nu mbe r o f rou nd s . The n u mb e r of ro und s d e pe n d s o n t he s i z e of ke y u se d f or t he p roc e s s .

3 . 2 . 2 . 2 . 2 A l g o r i t h mi c M o d e l

St e p 1: Ge t k e y f r o m fi l e . St e p 2: Ge t t he t e xt fr o m t he fi l e . St e p 3: Ge ne ra t e t he re qui re d S- Box. St e p 4: Ge ne ra t e t he nu mbe r o f r o und s St e p 5: Re pe a t the a l g o ri t h m f or t he n u mb e r o f ro un d s.


3 . 2 . 2 . 2 . 3 R e s tr i c ti o n s / L i mi ta ti o n s

The fi l e c ont a i n i n g t he k e y a n d t h e t e xt a r e t o be re a d. The nu mbe r of r oun d s ne e d s to be de t e r mi n e d be fo re a c t ua l p ro c e s s i n g.


3 . 2 . 2 . 2 . 4 L o c a l Da ta S t r uc t u r e s

The i n t e r me di a t e st a t e o f t he da t a whi c h i s be i n g e nc ryp t e d i s p re fe ra bl y s t o re d i n do u bl e -d i me n si ona l a r ra y s.

37

A. E. S.
3.3 S o ft wa r e I n t e r fa c e D e sc r i p t i o n

The s o f t wa re ' s i n t e rf a c e i s d i sc u s s e d b e l o w.
3 . 3 . 1 E x te r n a l sy s te m i n te r fa c e s

The

so ft wa re

is

t he

st a nd-a l o ne

a p p l i c a t i o n,

as

me n t i o ne d a b o ve a n d he n c e no t a va i l a b l e on l i ne o n a n y ne t wor k.
3 . 3 . 2 H u ma n i n t e r fa c e

The hu ma n i nt e r fa c e i s a gra p h i c a l c o n so l e ba se d u se r i n t e rf a c e , wh i c h a c c e p t s t he f i l e na me a nd f ul l p a t h o f t he sa me f ro m t he u se r. Re a d s ke y f ro m t h e d a t a b a se , ge ne ra t e s t he nu mb e r o f re qu i re d ro un d s and a l so ge ne ra t e s d i s pl a y s t he t he Su bs t i t u t i o n re l e va n t da t a Box e s . after Su b s e q u e nt l y

p e r fo r mi n g t he p roc e s s.

38

A. E. S.
4 . 0 User interface des ign

A de sc r i p t i on o f t h e u se r i n t e r fa c e de si gn o f t he sof t wa re i s pre se nt e d b e l o w.

39

A. E. S.
FUNCTIONS DESCRIPTION

DECRYPTION FUNCTION

MRHNHT

MNNMH;J.JJ. TH EN

40

A. E. S.
ENCRYPTION FUNCTION GBBBB MMM

K U K J K K U, ,

41

A. E. S. F F F F F E O N F M O D U L E WI S E D E S C R I P T I O N C T I N S N
MMEN INPUTS AND OUTPUT

The i n pu t a nd out pu t fo r t he AES a l go ri t h m e a c h c on s i s t of se que nc e s o f 1 28 bi t s ( di gi t s wi t h va l u e s of 0 o r 1 ) . The s e se q ue n c e s wi l l so me t i me s be re f e r re d t o a s bl oc k s a nd t h e n u mbe r of bi t s t he y c o nt a i n wi l l be r e fe r red t o a s t h e i r l e n gt h. Th e Ci p h e r Ke y fo r t h e AE S a l gor i t h m i s a se q ue n c e o f 12 8, 19 2 o r 2 56 b i t s . Ot he r i np ut , o ut p ut a n d Ci ph e r Ke y l e n gt h s a re n o t pe r mi t t e d b y t h i s st a nd a rd. The bi t s wi t hi n suc h se q ue nc e s wi l l be nu mbe re d s t a rt i n g a t z e r o a n d e nd i n g a t one l e s s t h a n t he se q ue nc e l en gt h (b l oc k l e n gt h o r ke y l e n gt h ). Th e n u mb e r i a t t a c he d t o a bi t i s k no wn a s i t s i nde x a n d wi l l be i n on e of t h e ra n ge s 0 < = i < 12 8, 0 < = i < 19 2 o r 0 < = i < 2 56 d e pe nd i n g o n t h e b l oc k l e n g t h a n d ke y l e n gt h ( s pe c i fi e d a b o ve ).
T h e S u b B y te s / I n v S u b B y te s t r a n s fo r ma t i o n

The

Sub Byt e s

Tra n sf or ma t i on on each Th e s ub s t i t ut i o n

is

a of

no n- l i ne a r t he St a t e (o r S- b ox

b yt e b yt e s ) is

su b st i t u t i o n, i n de pe n de n t l y.

ope ra t i n g

t a bl e

i n ve r t i b l e a n d i s c on s t ruc t e d by t he c o mpo s i t i o n o f t wo t ra n sf or ma t i o n s: 1. Fi r st , t a ki n g t he mu l t i p l i c a t i ve i n ve r se i n GF (2 8), 0 0 i s ma p p e d on t o i t se l f. 42

A. E. S. 2. Th e n, a pp l y i n g a n a f fi ne (o v e r GF (2 ) ) t ra n sf or ma t i o n de f i ne d by : S-b o x

F i g u r e : By te S u b a c t s o n t h e i n d i v i d u a l b y te s o f t h e S ta te .

The i n v e r se o f By t e Sub i s t he byt e su b st i t ut i on wh e re t h e i n ve r se t a bl e i s a p pl i e d. Thi s i s o bt a i n e d b y t he i n ve r se o f t h e a ff i ne ma pp i n g fo l l o we d b y t a ki n g t h e mu l t i pl i c a t i ve i n ve r se i n GF (2 8).


S h i ft R o ws ( ) / I n v S h i ft R o ws Tr a n s f o r ma ti o n

In t h e Sh i f t Ro ws ( ) t r a n s fo r ma t i o n, t h e byt e s i n t he l a s t t h re e ro ws of t he St a t e a re c yc l i c a l l y s hi ft e d o ve r di ffe re n t nu mb e r s o f by t e s ( o f f se t s ). The fi r st ro w, r = 0 , i s n ot sh i f t e d . Sp e c i fi c a l l y, t h e Sh i ft Ro ws () t ra n sf or ma t i o n pro c e e d s by ro w n u mb e r a s f ol l o w s: t he s hi ft va l u e s h i ft ( r , Nb) d e pe nd s o n t he r o w nu mb e r, r, a s fo l l o ws ( re c a l l t h a t Nb = 4 ): shi ft (1, 4) = 1; sh i ft (2, 4 ) = 2 ; s hi ft (3, 4) = 3 43

A. E. S. Th i s ha s t he e f fe c t of mo vi n g b y t e s t o l o we r p o s i t i o n s i n t he ro w (i . e . , l o we r va l u e s o f c i n a gi ve n ro w), whi l e t h e l o we s t by t e s wra p a rou n d i nt o t he t op o f t he r o w (i . e . , hi ghe r va l ue s of c i n a g i ve n ro w).

Fi gu re

i l l u st ra t e s

t he

S h i ft R o w s ( )

t ra n s fo r ma t i o n

AddRoundKey ()

In t he Ad d Rou nd Ke y () t ra n s fo r ma t i o n, a Ro u n d Ke y i s a d de d t o t he St a t e b y a s i mpl e bi t wi se XOR op e ra t i o n. Ea c h Rou nd Ke y c on si s t s o f Nb wo rd s fr o m t he k e y sc he d ul e . Th o se Nb wo rd s a re e a c h a d de d i n t o t h e c o l u mn s o f t h e St a t e . In t he Ci ph e r, t h e i ni t i a l Rou nd Ke y a d di t i o n o c c u r s wh e n r ou nd = 0, pr i o r t o t h e fi r st a p pl i c a t i o n of t h e ro un d fu n c t i o n ( se e Fi g. 5). Th e a ppl i c a t i o n o f t h e Ad d Rou nd Ke y () t ra n s fo r ma t i o n t o t he N r rou nd s of t h e Ci ph e r oc c u r s wh e n 1< = r ou nd < = Nr . 44

A. E. S. The a c t i on o f t hi s t ra n s fo r ma t i o n i s i l l u st ra t e d i n F i g, wh e re l = rou n d * Nb.

ADD ROUN D KE Y
K e y E x p a n s i o n-

A l g o r i t h m-

Ke y Ex pa n s i on (b y t e k e y [4 * Nk], wo rd w[ Nb *( Nr + 1) ], Nk) be gi n wor d t e mp i = 0 whi l e ( i < Nk) w[i ] = wo rd ( ke y[ 4* i ], ke y [4 *i + 1], ke y[ 4*i + 2 ], ke y [4 *i + 3 ])

45

A. E. S. i = i +1 e nd whi l e i = Nk whi l e ( i < Nb * ( Nr + 1) ] t e mp = w[ i - 1 ] i f (i mod Nk = 0 ) t e mp = Sub Wo r d( Rot Wo rd (t e mp ) ) xor Rc on [ i / Nk] e l se i f ( Nk > 6 a n d i mod Nk = 4 ) t e mp = Sub Wo r d( t e mp ) e nd i f w[i ] = w[i - Nk ] xo r t e mp i = i + 1 e nd whi l e e nd

46

A. E. S.

KEY EXP ANS IO N WO RKI NG The AES a l gor i t h m t a ke s t he Ci p he r Ke y, K, a n d pe rf o r ms a Ke y Ex pa n s i on r o ut i ne t o ge n e r a t e a ke y sc h e du l e . The Ke y Ex pa n s i on ge ne ra t e s a t ot a l o f Nb ( Nr + 1 ) wo rd s : t h e a l go r i t h m re qu i re s a n i n i t i a l s e t of Nb wor d s, a nd e a c h of t he Nr ro u n d s r e qu i r e s Nb wo r d s o f ke y da t a . The re su l t i n g ke y sc h e du l e c on si s t s o f a l i ne a r a r ra y of 4 - b yt e wo rd s, de n o t e d [w i ], wi t h i i n t he ra n ge 0 < = i < Nb ( Nr + 1 ).

47

A. E. S.
D ES I G N S O F T WA R E A R C H I T E C T U R E

Ma i n Mo du l e

De c r yp t i o n 10 Roun d s Ac c e p t Te x t

E or D ??

Enc r ypt i o n 10 Ro un d s Ac c e p t Te x t

Ci ph e r Te x t

Pl a i n Te x t

Ac c e p t Ke y

Ke y

Ke y

Ac c e pt

De c r yp t e d

En c r ypt e d Cod e

48

A. E. S.
ACT IVIT Y DIAGRAM

In t e r fa c e 1. Enc r yp t i o n 2. De c ryp t i on Enc r ypt De c r yp t

In t e r fa c e ( Se c o n d Wi n 1. 128 2. 192 3. 256 128 ? 25 6 192

Pa r t i c ul a r Pl a i n Te x t Ke y Ap pe nd num of t h re a d s i n c i ph e r

En g2 Ge t By
PutBytes

Ne w Th re a d

AE S

Pr i n t

49

A. E. S.
SEQUENCE DIAGRAM

In t e r fa c En g 2 e p ut fi l e : ge t In p ut : ge t ke y : Ge t Byt ease s : t a b: AES Nt :

Di a gra m ( i i i ) : Se qu e n c e Di a gra m

50

A. E. S.
FUNCTIONAL BLOCK DIAGRAM-

51

A. E. S.
S ta t e - T r a n s i ti o n D i a g r a m

Events

E v e n t 1 : Use r g i ve s fi l e na me a nd f i l e

pa t h.
E v e n t 2 : Use r c h oo se s be t we e n Enc r ypt i o n

a nd De c r ypt i o n
E v e n t 3 : De t e r mi ne n u mb e r o f ro u nd s. E v e n t 4 : St a rt Ro un d s E v e n t 5 : Re a d Ke y E v e n t 6 : Re a d St a t e E v e n t 7 : P e r fo r m Enc ryp t i on E v e n t 8 : P e r fo r m De c ry pt i on E v e n t 9 : Re c or d St a t e E v e n t 1 0 : Ge ne ra t e Ou t p ut Fi l e

52

A. E. S.

States

S t a t e 1 : The so ft wa r e i s i n re a dy s t a t e

( St a rt St a t e )
S t a t e 2 : Fi l e Pa t h a nd Na me a c c e p t e d S t a t e 3 : Us e r c ho i c e a c c e pt e d . S t a t e 4 : Ro u nd s d e t e r mi ne d S t a t e 5 : Ro u nd s St a rt e d. S t a t e 6 : Ke y i s re a d. S t a t e 7 : St a t e i s Re a d S t a t e 8 : Enc r yp t i on P e r fo r me d. S t a t e 9 : De c ryp t i on Pe rf or me d . S t a t e 1 0 : Sa t e Re c or de d S t a t e 1 1 : Out p ut Fi l e Ge ne ra t e d ( St o p )

53

A. E. S.
STAT E T RANS IT ION DIAGRAM

St a t e 1 Eve n t 1 St a t e 2 Eve n t 2 St a t e 3 Eve n t 3 St a t e 4 Eve nt 4 ( Enc ry pt i on ) St a t e 5 Eve nt 5 St a t e 6 Eve nt 6 St a t e 7


Event 7 State 8

Eve nt 4 ( De c ry pt i o n) St a t e 5 Eve n t 5 St a t e 6 Eve n t 6 St a t e 7


Event 8 State 9

Eve nt 9 St a t e Eve nt 10 St a t e 1 1

Eve n t 9 St a t e Eve nt 10

54

A. E. S.
FORM

55

A. E. S.

CHAPTER 4 RESU LT AN D AN ALY SI S


We h a ve i mp l e me n t e d AES i n NORM AL mo de a n d by u s i n g

M ULT ITHRE AD I NG o n di f fe r e n t p roc e s s o r s a nd t he be l o w gra p h sho ws t h e t i me i n mi l l i s e c o nd s t a ke n fo r e n c ryp t i on o f da t a b y di f fe re n t p roc e s s o r s , t h e gra p h i s a s f ol l o ws :

Ti me fo r e nc ry pt i o n a n d de c r yp t i o n ge t re d uc e d t o l a r ge e x t e n t whe n we u se t he mul t i t h re a d in g c o nc e p t i n AE S.

56

The

b e l o w d ra wn

gra p h s r e p re se n t

A. E. S. t h e t i me t a ke n f o r

e nc r y p t i o n a n d de c r yp t i on o f di ff e re n t si z e d a t a b y u si n g d i f f ke y si z e i n t he mul t i t h r e a de d e n vi r on me n t .
128 bit - 100 KB
90000 80000 70000 60000 50000 40000 30000 20000 10000 0 0 5 10 15 20 25 No of Threads

Execution Time (ms)

Encryption Time Decryption Time

192 bit - 100 KB


90000 80000 70000 60000 50000 40000 30000 20000 10000 0 0 5 10 15 20 25 No of Threads

Execution Time (ms)

Encryption Time Decryption Time

256 bit - 100 KB


100000 90000 80000 70000 60000 50000 40000 30000 20000 10000 0 0 5 10 15 20 25 No of Threads

Execution Time (ms)

Encryption Time Decryption Time

57

A. E. S.

CHAPTER 5

CONCLUSION

AE S i s t he mo s t se c u re e n c r ypt i o n a l gor i t h m kn o wn t i l l da t e . He nc e i t i s ne c e s sa ry t o op t i mi z e t he a l gor i t h m so t ha t i t c a n be u se d i n d i f fe r e nt a pp l i c a t i on s l i ke e mbe dd e d a s we l l a s s pa c e sy s t e ms , mob i l e a p pl i c a t i o n s e t c . Opt i mi z a t i o n i s i n t wo d o ma i n s, t i m e e ff i c i e nc y. F or op t i mi z e d e f fi c i en c y i n t h e t i me do ma i n we u se d Mul t i Thre a di n g. F ur t he r wh e n we u se d mul t i t h re a d i n g fo r e n c ry pt i o n, we ha d a c o n st ra i nt o f u si n g sa me nu mb e r of t h re a d s i n t he de c ryp t i on p r oc e s s a s we l l . Fu rt he r mo re ; this be i n g an e nc r yp t i o n a l go ri t h m, the

e nc r y p t i o n a nd d e c r yp t i on p r o c e s s i s c a r r i e d ou t on di f fe re n t ma c h i ne s. Th e s e ma c hi ne s ma y d i f fe r i n t he pe rf o r ma nc e a n d c a n ha ve d i ffe re nt ha rd wa r e c on f i gu ra t i o n s, t hu s c ha n gi n g t h e opt i ma l n u mb e r o f t h re a d s re qui re d f o r t h e p roc e s se s. No w, fo r t he i mp r o ve d pe rf o r ma nc e o f t he a l go r i t h m, i t i s nec e s sa ry t o wor k wi t h o pt i ma l n u mb e r o f t h re a ds. We ha ve t r i e d to o pt i mi z e d t he mo st se c u re e nc ry pt i o n

a l go r i t h m wi t h re s pe c t t o t i me so t ha t i t c a n b e fu rt he r u se d i n t he a pp l i c a t i on s t ha t h a ve t i me c on st ra i nt s. The a l go r i t h m ha s be e n op t i mi z e d wi t h re spe c t t o e xe c u t i o n t i me by u si n g mu l t i t h re a d i n g i n a l l t he mo de s o f o pe ra t i on. Th u s e na b l i n g t hi s a l go r i t h m t o b e mo r e fl e x i b l e a nd he nc e a l l o wi n g i t t o b e u se d i n mor e di ve r s i fi e d fi e l d s.

58

A. E. S. W h a t i s t h e p r o b l e m y o u h a v e tr i e d t o s o l v e ? W h y t h i s w o r k
i s i mp o r t a n t ?

AE S i s t he mo s t se c u re e n c r ypt i o n a l gor i t h m kn o wn t i l l da t e . He nc e i t i s ne c e s sa ry t o op t i mi z e t he a l gor i t h m so t ha t i t c a n be u se d i n d i f fe re n t a p pl i c a t i o n s l i ke e mbe dd e d sy st e ms , mob i l e a p pl i c a t i o n s e t c . Opt i mi z a t i o n i s i n t wo d o ma i n s, t i m e a s we l l a s s pa c e e ff i c i e nc y . Fo r opt i mi z e d e f fi c i e nc y i n t h e t i me d o ma i n we u se Mu l t i Thre a di n g. F ur t he r whe n we u se mul t i t h re a di n g fo r e n c r yp t i o n , we h a ve a c o n st ra i nt of u si n g sa me n u mbe r o f t hr e a d s i n t he de c r yp t i o n p ro c e s s a s we l l . He nc e we ha v e p ro po se d a d i f f e re n t mo de o f op e ra t i on i n whi c h t he de c r yp t i o n c a n u se di f fe r e nt n u mb e r of t hre a d s a s use d i n e nc ry pt i on. Fu rt he r mo re ; this be i n g an e nc r yp t i o n a l go ri t h m, the

e nc r y p t i o n a nd d e c r yp t i on p r o c e s s i s c a r r i e d ou t on di f fe re n t ma c h i ne s. Th e s e ma c hi ne s ma y d i f fe r i n t he pe rf o r ma nc e a n d c a n ha ve d i ffe re nt ha rd wa r e c on f i gu ra t i o n s, t hu s c ha n gi n g t h e opt i ma l n u mb e r o f t h re a d s re qu i re d f or t he p roc e s se s. No w, fo r t he i mp r o ve d pe rf o r ma nc e o f t he a l go r i t h m, i t i s nec e s sa ry t o wor k wi t h o p t i ma l nu mbe r o f t h re a ds. He nc e , we ha ve p ro p o se d a n a l go r i t h m f o r f i n di n g t he o p t i ma l n u mbe r o f t h rea d s wi t h re spe c t t o t he gi ve n ma c h i ne . We ha v e op t i mi z e d t h e mo st se c u re e nc r ypt i o n a l g o ri t h m wi t h re spe c t t o t i me so t ha t i t c a n be f u rt he r u se d i n t he a p pl i c a t i o n s t ha t ha ve me mo r y c o n st ra i nt s. Th e a l go ri t h m ha s be e n opt i mi z e d wi t h re s pe c t t o e xe c ut i on t i me b y u s i n g mu l t i t h re a d i n g i n a l l t he mo de s of o pe ra t i on. Th u s e na b l i n g t h i s 59

A. E. S. a l go r i t h m t o b e mo r e fl e x i b l e a nd he nc e a l l o wi n g i t t o b e u se d i n mor e di ve r s i fi e d fi e l d s. . Wh a t i s y o u r a p p r o a c h o r s o l u t i o n ? The f i rs t pa r t of t h e so l u t i on de a l s wi t h M ul t i Th r e a d i n g i n t h e ICBC mo de . To a c c o mp l i sh t he b e s t t h ro u gh pu t t i me t h e ICB C mod e h a d t o b e i mp l e me n t e d. Si nc e t he CBC mo de do e s no t su pp o r t mul t i t h re a di n g du ri n g e n c r yp t i o n , t h e ICBC mo d e pro ve s t o be b e t t e r. The o t he r me nt i one d pr ob l e m i s t he u se o f di ffe re nt n u mbe r o f t h re a d s fo r t he e nc ry p t i o n a nd d e c r yp t i o n pro c e s se s.
W h y i s i t be t te r / d i ffe r e n t t h a n o t he r e x i st i n g a p p r o a c h e s o r solutions?

ICBC i s o ne o f t he p ro po se d mo de s o f o pe ra t i on i n re s e a rc h pa pe r s, whi c h i s t he mul t i t h re a d e d f or m of CBC ( Ci phe r Bl oc k Ch a i n i n g). But t i l l da t e , n o wor k ha d be e n d on e o n i t s i mp l e me n t a t i o n o n AE S. He nc e w e h a ve i mp l e me nt e d t he ICB C mod e of o pe ra t i o n, wh i c h e na bl e s us t o u se mul t i t hr e a d i n g i n e nc r y p t i o n a s we l l a s de c ry p t i o n. Ea rl i e r, i n CBC mo de mu l t i t h re a d i n g wa s n ot p o s si b l e i n e n c r ypt i o n, a s t he e nc r yp t i on wa s pe r fo r me d i n c ha i ne d mode i . e . e nc r yp t i o n o f p re vi o u s bl oc k wa s a pre - re q u i s i t e f or e nc ry pt i on of ne w b l oc k. The re fo re , wi t h t he u s e o f mu l t i t h re a di n g i n e nc r yp t i on, t h e al g or i t h m be c o me s more op t i mi z e d wi t h re sp e c t t o e xe c u t i on t i me . Fu rt he r, n o wo r k ha d be e n d one e mp h a si z i n g o n u si n g di f fe re n t nu mbe r o f t h re a d s i n e nc ryp t i on a nd de c r y p t i o n. He nc e we ha v e pro po se d a n o ve l a l g o ri t h m wh i c h a l l o ws t he ma c hi n e t o u se opt i ma l n u mb e r o f t h re a d s de p e ndi n g o n t he i r p e r fo r ma nc e , 60

A. E. S. ra t he r t ha n c o mp e l l i n g t h e de c r y pt i n g ma c h i ne t o u se sa m e nu mbe r o f t h re a d s a s u se d b y e nc r ypt i n g on e . Our ot he r p r op o se d a l go r i t h m a l l o ws t he ma c h i n e t o f i n d opt i mi z e d n u mb e r o f t hr e a d s a c c ord i n g t o t h e c on s t ra i n t s. No c onc re t e wo r k h a d be e n d one t i l l d a t e i n t h i s fi e l d.

61

A. E. S.

CHAPTER 6

FUTUR E WORK

Interle ave d C ipher Bloc k C haining (ICBC )


Bo t h t h e a b o ve me t h o d s i mp l e m e nt e d a r e n ot u se f ul whe n i t c o me s t o mul t i - t h re a di n g. To de l i ve r hi gh pe r fo r ma nc e whi l e ma i nt a i n i n g h i gh l e ve l o f s e c u ri t y a s s u ra nc e i n re a l s y st e ms , t hi s pa rt i c u l a r mo d e wa s p ro po se d. Thi s mode c re a t e s mul t i pl e i nt e r l e a ve d e nc ry p t i o n s t re a ms i n st e a d o f j u st one . In a n n wa y i nt e r l e a v e d c ha i ni n g, t he f i r st a nd e ve ry ( n +1 )t h b l o c k t he re a ft e r a re e n c ry pt e d i n CBC mod e , t he se c on d (n + 2 )t h a n d e ve r y n t h b l o c k t he re a f t e r a re e n c ryp t e d a s a n ot h e r s t re a m, a n d so on. Si nc e e n c ry pt i on wa s no t s t ra i ght a wa y p o s si b l e i n CBC mo de , t hi s c a l l e d f o r a n i mp l e me n t a t i o n i n a ne w t y pe o f mo de o f ope ra t i on. The ne w mo de wa s IC BC. In t hi s mo de fi r st t hr e a d a c t s o n t he f i r s t b l oc k wi t h a n I ni t i a l Ve c t o r IV1, t he se c on d t h re a d a c t s o n t he se c on d bl oc k wi t h a n o t h e r Ini t i a l Ve c t o r IV2, a nd so o n. Th e ou t p u t of t he fi r st b l o c k a c t s a s t h e i npu t fo r N+ 1 t h b l o c k. The first N bl oc ks a re s i mul t a ne ou sl y pro c e s se d, i nde pe n de n t of e a c h ot he r a n d p a ra l l e l t o e a c h ot he r. On l y t he N+ 1t h bl o c k re q ui re s t h e ou t p ut o f t he f i r s t bl oc k, a nd s i n c e bo t h t he b l oc ks a re be i n g a c t e d up on by t h e sa me t h re a d, t hi s ma ke s it pos s i b l e to i n c o rp ora t e mul t i t h re a di n g i n t h e e nc ryp t i on p roc e s s. 62

A. E. S.

Cha i n Cha i n Ch a i n Cha i n


I C B C mo d e of o p er a t i o n

63

A. E. S.

APPENDIC ES
Java

The i n ve nt or s of Ja va wa n t e d t o d e s i gn a l a n gua ge whi c h c o ul d of fe r so l ut i o n s t o so me of t he p ro bl e ms e nc ou n t e re d i n mode r n pro gr a mmi n g. Th e y wa nt e d t he l a n g ua ge to be no t on l y re l i a b l e , p or t a b l e a nd di s t r i b u t e d bu t a l so si mp l e , c o mp a c t a n d i nt e ra c t i ve . Su n Mi c ro s y st e ms o f fi c i a l l y de sc r i be s Ja va wi t h fo l l o wi n g a t t ri b ut e s :  Co mpi l e d a n d i nt e rp re t e d  Pl a t f or m i nde pe n de n t a nd po rt a b l e  Obj e c t Ori e nt e d  Robu s t a n d se c u re  Di st ri bu t e d  Fa mi l i a r, s i mpl e a nd s ma l l  M ul t i t hre a d e d a nd i n t e ra c t i ve  Hi gh pe rf or ma nc e  Dyna mi c a nd e xt e n si b l e In t he Ja va p ro gr a mmi n g l a n gua g e , a l l s ou rc e c ode i s f i r s t wri t t e n i n pl a i n t e xt f i l e s e nd i n g wi t h t he . j a va ext e n si o n . Th o se sou rc e f i l e s a re t he n c o mpi l e d i n t o . c l a s s f i l e s by t h e j a va c c o mpi l e r. A . c l a s s fi l e d o e s n o t c o nt a i n c ode t h a t i s na t i ve t o y ou r p roc e s s or ; i t i n st e a d c o n t a i n s b yt e cod e s t h e ma c h i ne l a n g ua ge o f t he Ja v a Vi rt ua l Ma c hi ne1 ( Ja va VM ). Th e j a va l a u nc he r t o o l t h e n ru n s y ou r a ppl i c a t i on wi t h a n i n s t a nc e of t he Ja va Vi rt ua l Ma c hi ne

64

A. E. S.

Be c a u se t he J a va VM i s a va i l a b l e on ma n y di f fe r e n t o pe ra t i n g sy s t e ms, t he sa me . c l a s s f i l e s a re c a p a bl e of ru n n i n g o n M i c r o so ft Wi n do ws, t he Sol a ri s TM Op e r a t i n g Sy s t e m ( Sol a ri s OS) , Li nu x, or Ma c OS. So me vi r t ua l ma c h i ne s, suc h a s t h e Ja v a Hot Sp ot vi r t u a l ma c hi ne, pe r fo r m a dd i t i on a l s t e p s a t run t i me t o gi ve yo u r a ppl i c a t i on a pe rf or ma nc e bo o st . Thi s i nc l ude va ri ou s t a s k s suc h a s f i n di n g p e r fo r ma nc e b ot t l e ne c k s a nd re c o mpi l i n g (t o na t i ve c o de ) fre que nt l y u se d sec t i on s o f c ode .

Through the Java VM, the same application is capable of running on multiple platforms.

65

A. E. S.
T h e J a v a P l a t fo r m

A p l a t fo r m i s t he h a r d wa re or so ft wa re e n vi ro n me n t i n wh i c h a pro gr a m ru n s. We ' ve a l r e a d y me nt i one d so me o f t he mo s t pop ul a r pl a t fo r ms l i ke M i c ro so ft Wi n do ws, Li nux, Sol a r i s OS, a nd Ma c OS. Mo s t p l a t for ms c a n b e de sc ri b e d a s a c o mbi na t i o n of t he ope ra t i n g sy st e m a n d un d e r l y i n g h a r d wa re . The J a va pl a t f or m d i f fe r s fr o m mo s t o t h e r p l a t fo r ms i n t h a t i t ' s a so ft wa re - on l y p l a t fo r m t ha t r un s on t op of o t he r ha rd wa reba s e d p l a t fo r ms. The Ja va p l a t fo r m ha s t wo c o mp on e nt s:
y The Ja va Vi r t ua l Ma c h i ne y The Ja va Ap pl i c a t i o n P ro gr a mmi n g In t e rfa c e ( AP I)

You ' ve a l re a d y be e n i nt ro duc e d t o t he Ja va Vi rt u a l M a c h i n e ; i t ' s t h e ba se fo r t he Ja va pl a t fo r m a n d i s p or t e d on t o va r i o u s ha r d wa re - ba se d p l a t f o r ms . The AP I i s a l a r ge c ol l e ct i o n o f re a d y - ma de s of t wa re c o mpo ne n t s t ha t p r o vi d e ma ny u se fu l c a pa b i l i t i e s. It i s gr oupe d i n t o l i bra ri e s of re l a t e d c l a s se s a n d i nt e r fa c e s ; t he s e l i b ra r i e s a re kn o wn a s pa c ka ge s

The AP I a n d Ja va Vi rt ua l Ma c hi ne i n s ul a t e t h e p ro gra m f ro m t he u nde rl yi n g ha rd wa re .

66

A. E. S.

M ATHEM ATI CA L D ESC RIP TI ON

ENCRYPTION AND DECRYPTION IN ECB MODE

ECB-MULTI THREADED ENCRYPTION

67

A. E. S.

ECB MULTI THREADED DECRYPTION

68

A. E. S.

CIPHER BLOCK CHAINING ENCRYPTION

He re Ea c h t h re a d i s de pe n de n t on p re vi ou s o u t p ut hen c e mul t i t h re a di n g i s n ot p o s si bl e ( sa me i n CF B a nd OF B)

69

A. E. S.

CBC DECRYPTION

70

A. E. S.

71

A. E. S.

DESCR IPTI ON OF SY M BOLS :


Main Module

Ac t s a s u se r

i nt e rfa c e fo r a c c e pt i n g f i l e , ke y

a nd f or p e r f or mi n g e nc ry pt i o n o r de c ry pt i o n fu nct i o n.
AddRoundKey

Tr a n s fo r ma t i on i n t h e Ci ph e r a n d In ve r s e Rou n d Ke y i s a d de d t o t h e St a t e u si n g a n

Ci ph e r i n whi c h a t he St a t e

XOR o pe r a t i on . Th e l e n gt h o f a Ro un d Ke y e q ua l s t he si z e o f (i . e . , fo r Nb = 4, t he Roun d Ke y l e n gth e qua l s 12 8 bi t s / 1 6 by t e s).


MixColumns

Tra n sf o r ma t i o n i n t he Ci ph e r t ha t t a ke s a l l o f St a t e a n d mi xe s t he i r da t a ( i nd e pe n de n t l y

t he c o l u mn s of t he

of o ne a n o t h e r ) t o p rod uc e ne w c o l u mn s.
S h i ft R o ws

Tra n s fo r ma t i o n i n t he Ci ph e r t ha t p roc e s se s t h e o ff se t s. Tra n s fo r ma t i o n i n t he Ci p h e r t ha t p r o c e s se s t h e no nl i n e a r b yt e s u bs t i t u t i o n t a b l e ( S- b o x) t ha t of t he St a t e by t e s i nde pe n de n tl y. t ha t

St a t e b y c yc l i c a l l y s h i ft i n g t he l a s t t hr e e ro ws o f t he St a t e b y di ffe re nt
S u b B y te s

St a t e u s i n g a

ope r a t e s on e a c h
SubWord

Fu nc t i o n u se d i n t h e Ke y Exp a ns i o n ro ut i n e

t a ke s a f ou r -b y t e i npu t wo rd a nd a ppl i e s a n S- b ox t o e a c h o f t he fou r b y t e s t o p ro du c e a n ou t p ut wo r d.


InvMixColumns

Tra n sf o r ma t i on i n t h e In ve r se Ci p he r t h a t i s

t he i n ve r se o f Mi x C o l u m ns ( ) .
I n v S h i ft R o ws

Tr a n s fo r ma t i o n i n t he In v e r s e Ci ph e r t ha t i s

t he i n ve r se o f S h i ft R o ws ( ) . 72

I n v S u b B y te s

A. E. S. Tra n sf or ma t i o n i n t he In ve r se Ci p he r t ha t i s t h e

i n ve r se o f S u b B y te s ( ) .
Nb

: No. o f c ol u mn s( 3 2 bi t ) c o mp r i si n g t he st a t e . Fo r t hi s

st a nda r d Nb = 4
N k : No. o f 3 2 b i t wo r d s c o mp r i s i n g t h e c i phe r ke y. F or t hi s

Nk= 4, 6 o r 8
N r : No. o f rou n d s wh i c h i s a fu n c t i o n o f Nk a nd Nb( wh i c h i s

fi xe d ). F o r t hi s s t a nd a r d Nr =1 0, 1 2 , 14
R c o n : The rou nd c o n st a n t wo rd a rra y Rot Word:

F unc t i on u se d i n t h e ke y e x pa n s i on rou t i ne t ha t

t a ke s a fou r b yt e wo rd a n d pe rf o r ms a c yc l i c pe r mu t a t i on
P r i n t - Us i n g f u nc t i o n o ve r l oa di n g 3 f unc . o f p r i n t a r r a y ( )

wou l d be c re a t e d a n d wo ul d b e c a l l e d up on a s pe r t he va l ue s pa s s e d . Th i s mo d ul e wi l l c o nt a i n a l l t h e p ri nt fu nct i o n u se d fo r t he p ro j e c t . Al l p ri nt fu nc t i o n me a n s p ri nt fo r s i mpl e ECB, CBC, ICB C mode s wi l l re qui re s i mp l e p r i n t i n g b ut t h re a di n g wi l l re qu i re nu mbe r of t hre a d s c re a t e d at t he t i me of Enc r y pt i o n a s pe r F IP S d oc u me nt .
Copy-

Us i n g

c o n s t r uc t or

o ve rl oa d i n g

copy()

na me d

c on st ru c t o r wi l l b e c re a t e d di f fe re nt i a t e d on t he ba s i s of va l ue s pa s s e d . Cop y wi l l c o n t a i n t he s t a t e a r ra y . Thi s i s t h e i ni t i a l st a t e a r ra y a nd up da t e i t so t ha t i t c a n be u se d wi t h d i f fe re n t fun c t i on s. St a t e a r ra y wi l l b e re qu i re d by a l l 4 fu nc t i o n s.

73

A. E. S.
PutBytes-

Wi l l

be

u si n g

t hre e

fu nc t i o n

p u t ( ),

p u t B y te ()

and

t hr e a d ( ) . P ut () a n d pu t By t e () fo r Pb o x a n d t h re a d( ) f o r

ge t t i n g nu mb e r o f t hr e a d s.
AESencrypt-

Wi l l

h a ve

f ol l o wi n g

fun c t i on C i p h e r ( ),

I n v C i p h e r ( ),

K e y E x p a n s i o n ( ) . Ci p he r( ) a nd I n vCi ph e r () wi l l u se t h e

o ve rl o a di n g c o nc e p t t o pa s s he

va l u e s. Fo r si mp l e we

ha ve t e x t a nd ke y a s i n p u t whe r e a s f or t hre a di n g no. o f t h re a d s wi l l be a d d e d. Ke yExpa n s i o n ( ) wi l l be u s e d a s pe r ke y Ex pa n s i on Al go ri t h m


EngtoHex-

Wi l l ha ve t h re e fun c t i on t o H e x () , t o E n g ( ) a n d c o n v e r t( ) fo r c o n ve rt i n g En g t o he x a n d vi se ve r sa .
A ES ta b l e s

Th i s wi l l a c t a s t h e b a c ku p fo r p ro j e c t . St a t e a s we l l a s Rc on a r ra y wi l l b e u p da t e d e ve ry t i me a f u nc t i o n ru n s s o this woul d s t o re t he u pd a t e d a rra y s. Sbo x wi l l be i mp l e me n t e d i n t hi s.


A ES te s t -

Th i s wi l be t he c a l l i n g o r s t a rt i n g modu l e . Ta k e t h e a nd ke y a s i n pu t .
Ge t B y te s

fi l e

Imp l e me nt s Ge t By t e fun c t i on.

74

A. E. S.

75

A. E. S.

WORKIN G:
AES- 12 8 ( Nk= 4, Nr = 10 ) P LAINTEXT: 0 01 1 22 3 3 44 5 56 67 788 99a a bbc c d de e f f

KEY: 0 001 02 030 40 506 07 0 8 09 0a 0 b0c 0 d0e 0 f


CIPHER (ENCRYPT):

rou n d [ 0 ]. i npu t rou n d [ 0 ]. k_ sc h rou n d [ 1 ]. st a rt rou n d [ 1 ]. s_ box rou n d [ 1 ]. s_ ro w rou n d [ 1 ]. m_c o l rou n d [ 1 ]. k_s c h rou n d [ 2 ]. st a rt

0 01 1 2 23 3 44 55 6 6 77 8 89 9a a bbc c dde e f f 0 001 02 030 40 506 070 809 0 a 0 b0 c 0d 0e 0 f 0 010 20 304 05 060 708 090 a 0 b 0c 0 d0e 0f 0 6 3c a b 70 4 0 95 3 d0 51c d 60e 0e 7 b a 7 0e 1 8c 635 3e 0 8c 0 9 6 0e 1 04c d 70 b75 1ba c a d 0 e 7 5 f 72 641 55 7f 5bc 9 2f 7 be 3b 29 1db 9f 9 1a d6a a 74 fd d 2a f7 2 fa da a 67 8f 1d 6a b 7 6 fe 8 9d8 10e 88 55a c e 6 82 d 18 43 d8c b12 8 fe 4 76

rou n d [ 2 ]. s_ box rou n d [ 2 ]. s_ ro w

A. E. S. a 761c a 9b 9 7 be 8 b 45d 8a d 1a 6 11 fc 9 736 9 a 7be 1a 6 9 97 a d 7 3 9bd 8c 9c a 4 5 1f 61 8b6 1

rou n d [2 ]. m_c o l f f 87 9 68 431 d8 6a 5 1 64 5 151 fa 77 3 a d0 0 9 rou n d [ 2 ]. k_ sc h b 69 2c f 0b 6 43 d b df 1be 9 bc 5 00 6 83 0 b 3fe rou n d [ 3 ]. st a r t 49 1 55 9 8f 55e 5d 7a 0d a c a 94 fa 1 f0a 63 f7 rou n d [3 ]. s_ box 3b 59c b7 3 fc d90 e e 0 5 77 4 22 2d c 06 7f b6 8 rou n d [3 ]. s_ ro w 3b d9 2 26 8 f c 74 f b73 576 7c be 0c 0 59 0e 2d rou n d [3 ]. m_c o l 4c 9c 1e 6 6 f7 71 f07 62c 3 f8 6 8e 53 4d f2 56 r ou nd [3 ]. k_ sc h rou n d [4 ]. st a r t b 6f f7 44 e d2c 2c 9 b f6 c 590 c b f04 6 9 bf 41 fa 6 36a 2 82 5 b 33 9c 9 406 68a 3 15 7 2 44 d 17

rou n d [4 ]. s_ box 2d fb 023 43 f6 d1 2dd 093 37e c 75 b36 e 3 f0 rou n d [4 ]. s_ ro w 2d 6d 7 e f 03 f3 3e 3 34 0 93 6 02 dd 5b fb 12c 7 rou n d [4 ]. m_c o l 6 385 b7 9 f fc 538 df 9 97 be 47 8e 7 547 d6 9 1 rou n d [4 ]. k_ sc h 4 7f 7 f 7b c 953 53e 0 3 f9 6 c 3 2bc fd 05 8 d fd rou n d [5 ]. st a r t 24 7 24 02 369 66 b3 fa 6e d2 75 328 84 2 5b 6 c rou n d [5 ]. s_ box 36 400 92 6f 9 3 36 d 2d 9fb 59 d2 3c 4 2 c 39 5 0 rou n d [5 ]. s_ ro w 36 33 9 d5 0 f 9b 53 92 69f 2c 0 92 dc 4 406 d2 3 rou n d [5 ]. m_c o l f 4bc d 4 54 3 2e 5 54 d0 75f 1d 6c 5 1d d03 b3c rou n d [5 ]. k_ sc h 3c a a a 3e 8a 9 9f 9de b50 f3a f 57a d f 6 22 a a rou n d [6 ]. st a r t c 81 677 bc 9 b7a c 93 b 250 279 92 b0 2 61 9 9 6 rou n d [6 ]. s_ box e 84 7 f 56 5 14 da d de 2 3f 7 7 b6 4fe 7f 7 d 49 0 rou n d [6 ]. s_ ro w e 8da b6 9 0 14 7 7d 46 53f f 7 f 5e 2e 74 7dd 4f rou n d [6 ]. m_c o l 9 816 e e 74 0 0 f8 7f 55 6b2c 04 9c 8 e 5a d 036 rou n d [6 ]. k_ sc h 5 e 39 0f 7d f7a 69 29 6a 75 53 d c 1 0a a 3 1f 6b rou n d [ 7 ]. st a rt c 6 2fe 10 9f 7 5e e dc 3c c 7 939 5 d 84 f9c f5 d rou n d [7 ]. s_ box b4 15 f80 16 8 5 85 5 2e 4bb 612 4c 5 f 998 a 4c rou n d [ 7 ]. s_ ro w b4 58 1 24 c 6 8 b6 8a 0 14b 99 f8 2e 5 f1 555 4c 77

A. E. S. rou n d [7 ]. m_c o l c 5 7e 1c 1 5 9a 9 bd2 8 6f0 5 f4b e 09 8c 6 34 3 9 rou n d [7 ]. k_ sc h 1 4f 97 01a e 3 5 fe 2 8c 440a df 4d 4e a 9 c 02 6 rou n d [ 8 ]. st a rt d 18 76c 0 f 7 9c 43 0 0 a b45 59 4 a d d6 6 f f4 1f rou n d [ 8 ]. s_b ox 3e 1 7 50 7 6 b6 1 c 04 6 78d fc 2 29 5f 6a 8 bf c 0 rou n d [ 8 ]. s_ ro w 3e 1c 22c 0 b 6fc b f7 6 8da 8 5 067 f 617 04 9 5 rou n d [ 8 ]. m_c o l ba a 03 d e 7a 1f 9b 56e d55 12c ba 5 f4 14d 23 rou n d [ 8 ]. k_s c h 4 74 387 35a 41c 6 5b 9 e 01 6b a f4 a e b f7a d2 rou n d [ 9 ]. st a rt fde 3ba d 20 5 e 5 d0 d 73 5 479 64e f 1 fe 37 f1 rou n d [ 9 ]. s_b ox 54 11 f4b 56 b d 97 0 0e 96a 0 90 2 fa 1b b9a a 1 rou n d [ 9 ]. s_ ro w54 d9 9 0a 16 b a 09 a b 596 bb f4 0e a 1 117 02 f rou n d [ 9 ] . m_c o l e 9 f7 4 e e c 0 23 02 0f 61b f2c c f 235 3c 2 1c 7 rou n d [ 9 ]. k_s c h 5 49 93 2d1 f0 8 5 57 6 8 109 3e d 9 c be 2c 9 74e rou n d [1 0]. s t a rt b d6e 7c 3 df 2 b5 7 7 9e 0b6 121 6e 8 b 1 0b 6 89 rou n d [1 0]. s _bo x 7a 9 f 10 278 9d 5f 50 b 2be f fd 9f 3 dc a 4e a 7 rou n d [1 0]. s _r o w 7a d5 fd a 78 9e f4e 2 72b c a 10 0b 3 d9 f f5 9f r ou nd [1 0 ]. k_ sc h13 11 1d 7 fe 39 44a 1 7 f3 0 7a 78 b4 d2b 30c 5 rou n d [1 0]. ou t pu t 6 9c 4e 0d 8 6a 7b 0 43 0d8 c db 780 70 b 4c 55 a

IN V E R S E C I P H E R ( D E C R Y P T ) :

rou nd [0 ]. i np u t6 9c 4 e 0d 86a 7b 0 43 0 d 8c d b 78 070 b4c 55a rou nd [0 ]. i k_ sc h1 3 11 1d 7fe 39 4 4a 17 f30 7a 7 8b 4d 2b3 0c 5 rou nd [ 1 ]. i s t a r t 7a d 5f d a 7 89 e f4 e 2 7 2bc a 10 0b 3d9 f f5 9f rou nd [ 1 ]. i s_ ro w 7 a 9f 10 27 8 9d 5 f 50 b2b e f fd 9f 3dc a 4e a 7 rou nd [1 ]. i s _ b ox b d6 e 7c 3 df 2b 5 77 9 e 0b6 121 6e 8 b1 0 b6 8 9 rou nd [1 ]. i k_ sc h5 4 99 32 d1 f08 55 7 6 8 109 3e d 9 c be 2c 9 74e rou nd [1 ]. i k_a d d e 9f 74e e c 02 302 0 f 61bf2c c f 235 3c 2 1 c 7 78

rou nd [ 2 ]. i s t a r t

A. E. S. 54 d99 0a 1 6 ba 09 a b59 6bb f 4 0e a 11 1 70 2f

rou nd [ 2 ]. i s _ r o w 5 411 f 4b5 6b d 97 0 0e 96 a 09 02 fa 1 bb 9a a 1 rou nd [ 2 ]. i s _ bo x f de 3b a d2 05e 5 d 0 d73 547 96 4 e f1 fe 3 7f 1 rou nd [ 2 ]. i k_ sc h 47 438 73 5a 4 1 c 6 5 b9e 0 16 ba f 4a e bf 7a d 2 rou nd [ 2 ]. i k_a d d b a a 03 de 7a 1f 9 b 56 ed55 12c ba 5 f4 14 d23 rou nd [ 3 ]. i s t a r t 3e 1c 22c 0 b 6fc b f7 6 8da 8 5 067 f 617 04 9 5 rou nd [ 3 ]. i s _ r o w 3 e 17 507 6b 61c 0 4 67 8 dfc 22 95 f6a 8b fc 0 rou nd [ 3 ]. i s _ bo x d1 876 c 0 f7 9 c 43 0 0a b4 55 94a d d6 6 f f 41 f rou nd [ 3 ]. i k_ sc h 14 f97 01a e 35 fe 2 8c 44 0a d f4 d4e a 9c 0 26 rou nd [3 ]. i k_a d dc 57e 1c 1 5 9a 9b d 28 6f0 5 f4 b e 09 8c 6 34 3 9 rou nd [ 4 ]. i s t a r t rou nd [4 ]. i s _ b ox rou nd [4 ]. i k_ sc h rou nd [ 5 ]. i s t a r t b4 581 24c 6 8 b6 8 a 014 b99 f 82e 5f 155 54c c 62 fe 109 f 75e e d c 3c c 7 939 5d 8 4 f9 c f5 d 5 e 3 90 f7d f 7a 69 2 96 a 7 55 3dc 10a a 3 1 f6 b e 8da b6 9 01 4 7 7d 4 653 f f7 f5e 2e 7 4 7d d 4 f rou nd [4 ]. i s _ r o w b 415 f 801 68 5 85 5 2e 4b b6 124 c 5 f9 9 8a 4 c

rou nd [4 ]. i k_a d d 9 816 e e 7 400 f87 f5 5 6b 2 c 0 49c 8e 5a d03 6 rou nd [5 ]. i s _ r o w e 8 47 f5 65 1 4da d d e 23 f77 b6 4fe 7 f7d 49 0 rou nd [5 ]. i s _ b ox c 8 16 77b c 9b 7a c 9 3 b2 5 02 7 99 2b 026 19 9 6 rou nd [ 5 ]. i k_ sc h rou nd [6 ]. i s t a rt 3 c a a a 3e 8a 9 9 f9d e b50 f3 a f 57a df 6 2 2a a 36 33 9 d5 0 f 9b 53 92 69f 2c 0 92 dc 4 406 d2 3 rou nd [5 ]. i k_a d d f 4 bc d4 543 2e 5 54 d07 5f 1d 6c 5 1dd 03 b3c rou nd [6 ]. i s _ r o w 3 64 009 26 f9 3 3 6d 2 d9 f b5 9d 23c 4 2c 3 9 5 0 rou nd [6 ]. i s _ b ox 2 472 40 236 96 6 b 3f a 6e d 275 32 8 84 2 5 b6 c rou nd [6 ]. i k_ sc h rou nd [ 7 ]. i s t a r t 4 7 f7 f7 bc 9 535 3e 03 f 96 c 32 bc f d 0 58 df d 2d 6d7 e f 03 f3 3e 33 409 360 2d d 5 bf b12 c 7 rou nd [6 ]. i k_a d d 6 385 b7 9f fc 53 8 df 997 be 4 78e 7 54 7 d 69 1 rou nd [7 ]. i s _ r o w 2 df b0 234 3f 6 d 12 dd0 933 7e c 7 5b 3 6e 3f 0 rou nd [7 ]. i s _ b ox f a 63 6a 2 8 2 5b 3 39 c 940 668 a 31 57 2 44 d 1 7 79

rou nd [7 ]. i k_ sc h rou nd [7 ]. i k_a d d rou nd [ 8 ]. i s t a r t rou nd [8 ]. i s _ b ox

A. E. S. b 6 ff 74 4e d 2c 2c 9 bf6 c 59 0c b f0 46 9b f4 1 4c 9 c 1e 66 f7 7 1 f0 762 c 3f 86 8 e 5 34 d f 256 3b d92 26 8 fc 74 fb 7 3 57 6 7c be 0c 05 90e 2 d 49 1 55 9 8 f5 5e 5 d7 a 0da c a 94 fa 1 f0 a 63 f 7

rou nd [8 ]. i s _ r o w 3 b59 c b7 3 fc d9 0 e e 057 742 22 dc 0 6 7 fb 68 rou nd [8 ]. i k_ sc h b6 92c f0 b 64 3 d bd f 1be 9 bc 5 00 683 0b 3fe rou nd [8 ]. i k_a d d f f 879 68 4 31 d 8 6a 5 164 515 1 fa 7 73 a d 00 9 rou nd [ 9 ]. i s t a r t a 7be 1a 6 9 9 7a d 73 9bd 8c 9c a 4 5 1f 61 8b6 1 rou nd [9 ]. i s _ r o w a 7 61c a 9b 97 b e 8b 4 5d 8 a d 1a 6 11 fc 9 7 36 9 rou nd [9 ]. i s _ b ox 89 d 8 10 e 885 5a c e 682 d18 43 d8 c b12 8 fe 4 rou nd [ 9 ]. i k_ sc h d 6a a 7 4 fdd 2a f72 fa da a 6 7 8f 1d 6a b 7 6 fe rou nd [9 ]. i k_a d d 5 f7 26 415 57 f5 bc 9 2f7 be 3 b2 9 1 db 9 f9 1a rou nd [1 0]. i st a rt 6 35 3e 0 8c 0 960 e 1 04 c d 70 b75 1ba c a d0 e 7 rou nd [1 0]. i s_ ro w63 c a b7 04 0 9 53 d 0 51c d 60e 0 e 7 ba 7 0e 1 8c rou nd [1 0]. i s_ bo x 00 102 03 040 50 60 7 08 0 90 a 0b 0c 0 d0e 0f rou nd [1 0]. i k_ sc h 0 00 10 203 04 050 6 07 0 80 9 0a 0 b0c 0d 0 e 0 f rou nd [1 0]. i o u t p ut00 112 23 344 55 66 778 899 a a b bc c d de e ff

EQUIVALENT INVERSE CIPHER DECRYPT:

rou nd [ 0 ]. i i np ut rou nd [ 1 ]. i k_ sc h rou nd [ 2 ]. i s t a r t rou nd [ 2 ]. i s _ bo x rou nd [ 2 ]. i s _ r o w

6 9c 4e 0d 86a 7 b0 4 30d 8c d b78 07 0 b4 c 5 5 a 1 3a a 2 9 be 9c 8 fa f f6 f7 70 f58 00 0f 7b f0 3 54 d99 0a 1 6 ba 09 a b59 6bb f 40e a 11 1 70 2f fde 5 9 6f 10 5473 7d2 35 fe ba d7 f1 e 3d 04e f de 3 ba d2 05e 5d 0 d7 3 54 7 9 64e f1 fe 37 f1

rou nd [ 2 ]. i m_c o l 2 d7e 8 6a 33 9d9 39 3e e 6 570a 11 01 904 e 16

80

rou nd [ 2 ]. i k_ sc h rou nd [ 3 ]. i s t a r t rou nd [ 3 ]. i s _ bo x rou nd [ 3 ]. i s _ r o w rou nd [ 3 ]. i m_c o l rou nd [ 3 ]. i k_ sc h rou nd [ 4 ]. i s t a r t rou nd [ 4 ]. i s _ bo x rou nd [ 4 ]. i s _ r o w rou nd [ 4 ]. i m_c o l rou nd [ 4 ]. i k_ sc h rou nd [ 5 ]. i s t a r t

A. E. S. 1 36 2 a 4 63 8 f2 58 648 6b ff 5 a 7 6f 78 74a 8 3 3e 1c 22c 0 b 6fc b f7 6 8da 8 5 06 7 f 617 04 9 5 d1c 4 94 1 f79 55 f 40f b4 6f 6c 0a d6 87 30a d d 1 87 6c 0 f7 9c 4 3 00a b 45 594 a dd 6 6 f f41 f 3 9da e e 3 8 f4 f1a 8 2 a a f 43 241 0c 3 6d 4 5b 9 8 d8 2 fc 74 9c 4 72 22be 4da d c 3e 9c 7 81 0f 5 b4 581 24c 6 8 b6 8 a 014 b99 f 82 e 5f 155 54c c 65e 3 9 5d f77 9c f 09 c c f9e 1c 3 8 4 2fe d5 d c 6 2 fe 109 f 7 5e e d c 3c c 7 939 5d 84 f9c f5 d 9a 39b f 1d 0 5b 20 a 3a 4 76a 0 b f79 fe 511 84 7 2e 3 0 9 8d 1 1c 5 d e 5f 7 89 d fe 15 78a 2c c c b e 8da b6 9 01 4 7 7d 4 653 f f7 f5e 2e 7 4 7d d 4 f

rou nd [ 5 ]. i s _bo x c 8 7a 7 9 96 9 b 02 1 9 bc 25 26 773 bb 01 6 c 99 2 rou nd [ 5 ]. i s _ r o w c 8 16 77b c 9b 7a c 9 3 b2 5 02 7 9 92 b02 61 996 rou nd [ 5 ]. i m_c o l rou nd [ 6 ]. i s t a r t 1 8f 7 8d 7 7 9a 9 3e e f4 f6 74 296 7c 4 7f 5 f f d 36 339 d5 0 f 9b 539 269 f2c 09 2dc 44 0 6d 23 rou nd [ 5 ]. i k_ sc h 2 e c 4 10 2 76 32 6d7 d26 958 20 4a 0 03 f3 2de ro u n d [ 6 ]. i s _bo x 24 667 56c 69 d 2 5b 236 e 42 40 fa 8 87 2 b3 32 rou nd [ 6 ]. i s _ r o w 2 4 72 40 236 96 6b 3 fa 6e d 275 32 884 25 b 6c rou nd [ 6 ]. i m_c o l 8 5c f8 b f4 72 d12 4 c 1 03 4 8 f5 45 329c 00 5 3 rou nd [ 6 ]. i k_ sc h rou nd [ 7 ]. i s t a r t a 8 a 2 f5 044 de 2c 7 f50 a 7 e f7 986 96 7 1 29 4 2d 6d7 e f 03 f3 3e 33 409 360 2d d5 bf b12c 7

rou nd [ 7 ]. i s _ bo x fa b3 8 a 17 25 664 d 2 84 0 24 6 a c 957 63 393 1 rou nd [ 7 ]. i s _ r o w fa 63 6a 2 825 b3 3 9 c 94 0 66 8a 3 157 24 4 d1 7 rou nd [ 7 ]. i m_c o l rou nd [ 7 ]. i k_ sc h rou nd [ 8 ]. i s t a r t rou nd [ 8 ]. i s _ bo x f c 1 fc 1 f9 193 4c 9 821 0f b f b8 da 3 40e b 21 c 7 c 6e 39 1 e 54 03 2f1 47 9c 3 0 6 d63 19e 50c 3b d92 26 8 fc 74 fb 7 3 57 6 7c be0c 0 5 90 e 2 d 49e 5 94 f 755 c a 6 38f da 0 a 5 9 a 01 f1 5d 7 fa 81

rou nd [ 8 ]. i s _ r o w

A. E. S. 4 9 15 598 f5 5e 5 d 7a 0 d a c a 9 4fa 1 f 0a 6 3 f7

rou nd [ 8 ]. i m_c o l 0 76 5 18 f0 b5 2ba 2 fb7 a 1 5 c 8d 93 be 4 5 e 0 0 rou nd [ 8 ]. i k_ sc h a 0 d b0 2 99 228 6d 1 6 0a 2 d c 0 29c 24 85d 56 1 rou nd [ 9 ]. i s t a r t a 7be 1a 6 9 9 7a d 73 9bd 8 c 9c a 45 1f 61 8 b6 1 rou nd [ 9 ]. i s _ bo x 89 5 a 4 3e 4 851 88 f e 8 2d 1 2 10 6 8c b d8c e d8 rou nd [ 9 ]. i s _ r o w 8 9 d8 10e 885 5a c e 6 82 d 18 4 3 d8c b12 8 fe 4 rou nd [ 9 ]. i m_c o l rou nd [ 9 ]. i k_ sc h rou nd [1 0]. i st a rt e f05 3 f 7c 8 b3 d3 2fd 4d 2 a 6 4a d 3c 9 307 1a 8 c 56 d f f 082 5d d3 f98 0 5a d3 fc 8 65 9 d 7f d 6 35 3 e 0 8c 09 60e 1 04 c d 70 b75 1ba c a d0 e 7

rou nd [1 0]. i s_ bo x 00 5 0a 0 f0 40 90e 0 308 0d0 20 70c 0 10 6 0 b0 rou nd [1 0]. i s_ ro w 00 102 03 04 0 50 6 0 70 8 09 0 a 0b 0c 0 d0e 0 f 0 rou nd [1 0]. i k_ sc h 0 00 102 03 040 50 6 07 0 80 9 0a 0 b0c 0d 0 e 0

82

A. E. S.

COD IN G

ECB M OD E (F LOW OF C ON TR OL):

I N T E R F A C E C O D I N G U S I N G J A V A S WI N G S :

i mp o rt j a va . a wt . *; i mp or t j a va . a wt . e ve n t . * ; i mp or t j a va x. s wi n g. *; i mp or t j a va . i o. *; pub l i c c l a s s c r y pt o1 e x t e n d s JF ra me { pr i va t e J La be l j La b e l 1 ; pr i va t e J La be l j La be l 3 ; 83

A. E. S. pr i va t e J La be l j La b e l 4 ; Fi l e Di a l o g f i l e d i a l o g _ 1; pr i va t e J Ra d i o But t on j Ra d i o But t o n1; pr i va t e J Ra d i o But t on j Ra d i o But t o n2; pr i va t e J Ra d i o But t on j Ra d i o But t o n3; pr i va t e J Ra d i o But t on j Ra d i o But t o n4; pr i va t e J Ra d i o But t on j Ra d i o But t o n5; pr i va t e J Co mbo Box j Co mb o Bo x1 ; pr i va t e J But t o n j But t on 1; pr i va t e J But t o n j But t on 2; pr i va t e J But t o n j But t on 3; pr i va t e J Pa ne l c on t e n t Pa ne ;

pub l i c c ry pt o1 () { su p e r( ); i ni t i a l i z e Co mp o ne n t () ; t hi s. se t Vi s i b l e ( t r u e ); } pr i va t e vo i d i n i t i a l i z e Co mp one nt () { j La be l 1 = ne w J La be l ( ); j La be l 3 = ne w J La be l ( ); j La be l 4 = ne w J La be l ( ); 84

A. E. S. j Ra d i o But t o n 1 = ne w J Ra d i o Bu t t o n( ); j Ra d i o But t o n 2 = ne w J Ra d i o Bu t t o n( ); j Ra d i o But t o n 3 = ne w J Ra d i o Bu t t o n( ); j Ra d i o But t o n 4 = n e w J Ra di o Bu t t o n( ); j Ra d i o But t o n 5 = ne w J Ra d i o Bu t t o n( ); j Co mb o Box 1 = ne w J Co mbo Bo x ( ); j Co mb o Bo x 1. a dd It e m( " 1 28 " ); j Co mb o Box 1. a d d It e m( " 19 2 " ) ; j Co mb o Box 1. a d d It e m( " 25 6 " ) ; j Co mb o Box 1. se t To ol Ti p Te x t ( " se l e c t ke y s i z e " ); j But t o n1 = n e w J Bu t t on () ; j But t o n2 = n e w J Bu t t on () ; j But t o n3 = n e w J Bu t t on () ; c o nt e nt Pa n e = ( J Pa n e l )t hi s. ge t Co n t e n t Pa ne ( ) ; j La be l 1. se t Te xt ( " Exe c ut i o n Ti me : " ); j La be l 3. se t Te xt ( "j La be l 3 ") ; j La be l 4. se t Te xt ( " Ad va nc e d En c r y p t i on St a nda rd s " ); j Ra d i o But t o n 1. s e t Te xt ( " En c ry pt i o n" ) ; j Ra d i o But t o n 1. s e t Se l e c t e d( t r ue ); j Ra d i o But t o n 1. a d d It e mLi s t e ne r ( ne w It e m Li s t e ne r ( ) { pub l i c voi d i t e mSt a t e Cha n ge d ( It e mEve n t e ) { j Ra d i o But t on 1_ i t e mSt a t e Cha n ge d( e ); 85

A. E. S. } } ); j Ra d i o But t o n 2. s e t Te xt ( " De c ry pt i o n" ) ; j Ra d i o But t o n 2. s e t Se l e c t e d( fa l se) ; j Ra d i o But t o n 2. a d d It e mLi s t e ne r ( ne w It e m Li s t e ne r ( ) { pub l i c voi d i t e mSt a t e Cha n ge d ( It e mEve n t e ) { j Ra d i o But t on 2_ i t e mSt a t e Cha n ge d( e ); } } ); j Ra d i o But t on 3.s e t Te x t ( "1 2 8 " ) ; j Ra d i o But t o n 3. s e t Se l e c t e d( t r ue ); j Ra d i o But t o n 3. a d d It e mLi s t e ne r ( ne w It e m Li s t e ne r ( ) { pub l i c voi d i t e mSt a t e Cha n ge d ( It e mEve n t e ) { j Ra d i o But t on 3_ i t e mSt a t e Cha n ge d( e ); } } ); j Ra d i o But t o n 4. s e t Te xt ( "1 92 " ); j Ra d i o But t o n 4. s e t Se l e c t e d( fa l se ) ; j Ra d i o But t o n 4. a d d It e mLi s t e ne r ( ne w It e m Li s t e ne r ( ) { pub l i c voi d i t e mSt a t e Cha n ge d ( It e mEve n t e ) { j Ra d i o But t on 4_ i t e mSt a t e Cha n ge d( e ); 86

A. E. S. } } ); j Ra d i o But t o n 5. s e t Te xt ( "2 56 " ); j Ra d i o But t o n 5. s e t Sel e c t e d( fa l se ) ; j Ra d i o But t o n 5. a d d It e mLi s t e ne r ( ne w It e m Li s t e ne r ( ) { pub l i c voi d i t e mSt a t e Cha n ge d ( It e mEve n t e ) { j Ra d i o But t on 5_ i t e mSt a t e Cha n ge d( e ); } } ); j Co mb o Box 1. a d d Ac t i o n Li s t e ne r (n e w Ac t i on Li s t e ne r ( ) { pub l i c voi d a ct i o n Pe r fo r me d ( Ac t i o nEve n t e ) { j Co mbo Box 1_a c t i on Pe rf or me d(e ) ; } } ); j But t o n1. se t Te xt ( " Pl a i n Te x t " ); j But t o n1. a d d Ac t i o n Li s t e n e r (ne w Ac t i o n Li s t e ne r ( ) { pub l i c voi d a c t i o nPe r fo r me d ( Ac t i o nEve n t e ) { j Bu t t o n 1 _a c t i o nPer fo r me d (e ) ; } } ); j But t o n2. se t Te xt ( " Ke y " ); 87

A. E. S. j But t o n2. a d d Ac t i o n Li s t e n e r (ne w Ac t i o n Li s t e ne r ( ) { pub l i c voi d a c t i o nPe r fo r me d ( Ac t i o nEve n t e ) { j Bu t t o n 2 _a c t i o nPe r fo r me d (e ) ; } } ); j But t o n3. se t Te xt ( " Out pu t ") ; j But t o n3. a d d Ac t i o n Li s t e n e r (ne w Ac t i o n Li s t e ne r ( ) { pub l i c voi d a c t i o nPe r fo r me d ( Ac t i o nEve n t e ) { j Bu t t o n 3 _a c t i o nPe r fo r me d (e ) ; } } ); c ont e nt Pa ne . se t La you t (nu l l ); c ont e nt Pa ne . set Ba c kgro un d( n e wCol o r (22 8, 2 17 , 2 17 )) ; a dd Co mp on e n t (c ont e nt Pa ne , j La be l 1, 1 2, 34 8, 80, 2 7) ; a dd Co mp on e n t (c ont e nt Pa ne , j La be l 4, 12, 16, 3 3 1, 8 3 ) ; a dd Co mp on e n t (c ont e nt Pa ne , j La be l 3, 13 3, 34 9, 60, 2 6 ); a dd Co mpon e nt (c ont e nt Pa ne , j Ra d i o Bu t t o n 1, 2 6 , 12 2, 1 0 0, 2 4); a dd Co mp on e nt (c o nt e nt Pa ne , j Ra d i o Bu t t on 2, 24 8, 12 2 , 10 0 , 24 ) ; a dd Co mp on e nt (c o nt e nt Pa ne , j Ra d i o Bu t t on 3, 26, 1 56, 1 00, 2 4) ; a dd Co mp on e nt (c o nt e nt Pa ne , j Ra d i o Bu t t on 4, 14 9, 15 6 , 10 0 , 24 ) ; a dd Co mp on e nt (c o nt e nt Pa ne , j Ra d i o Bu t t on 5, 27 2, 15 6 , 10 0 , 24 ) ; a dd Co mp on e nt (c o nt e nt Pa ne , j Co mbo Bo x 1, 1 3 5, 1 0 3, 10 0, 21 ) ; 88

A. E. S. a dd Co mp on e n t (c ont e nt Pa ne , j Bu t t on1, 1 2, 21 3, 83, 28 ); a dd Co mp on e n t (c ont e nt Pa ne , j Bu t t on 2, 1 2 , 25 4, 8 3, 28 ); a dd Co mp on e n t (c ont e nt Pa ne , j Bu t t on 3, 1 2 , 29 5, 8 3, 28 ); t hi s. se t Ti t l e ( "c ryp t o 1 - e xt e nd s JF ra me ") ; t hi s. se t Loc a t i on (ne w Po i n t ( 0, 0 )) ; t hi s. se t Si z e (ne w Di me n s i o n( 4 0 0, 4 32) ) ; } pr i va t e vo i d a dd Co mpon e nt ( Co nt a i n e r c ont a i n e r, Co mpon e nt c , i n t x , i n t y, i nt wi d t h , i n t h e i gh t ) { c . se t Bo u nd s (x , y, wi dt h, he i gh t ) ; c o nt a i n e r. a dd (c ) ; } pr i va t e vo i d j Ra d i o Bu t t on 1_i t e m St a t e Ch a n ge d ( It e mEve n t e) { Sy st e m. o ut . pr i n t l n ( "\nj Ra d i o Bu t t o n 1_ i t e m St a t e Cha n ge d( It e mEv e nt e ) c a l l e d. " ); Sy st e m. o ut . pr i n t l n ( " > > " + (( e . ge t St a t e Ch a n ge ( ) It e mEv e nt . SELECTE D ) ? " se l e c t e d" : "u n se l e c t e d ") ); } pr i va t e vo i d j Ra d i o Bu t t on 2_i t e m St a t e Ch a n ge d ( It e mEve n t e) { Sy st e m. o ut . pr i n t l n ( "\nj Ra d i o But t o n2_ i t e m St a t e Cha n ge d( It e mEve nt e ) c a l l e d . " ); Sy st e m. o ut . pr i n t l n ( " > > " + (( e . ge t St a t e Ch a n ge ( ) It e mEv e nt . SELECTE D) ? " se l e c t e d" : "u n se l e c t e d ") ); == ==

89

A. E. S. / / TODO: Ad d a ny ha nd l i n g c o de he re } pr i va t e vo i d j Ra d i o Bu t t on 3_i t e m St a t e Ch a n ge d ( It e mEven t e) { Sy st e m. o ut . pr i n t l n ( "\nj Ra d i o Bu t t o n 3_ i t e m St a t e Cha n ge d( It e mEv e nt e ) c a l l e d. " ); Sy st e m. o ut . p r i nt l n ( " > > " + ((e . g e t St a t e Cha n ge ( ) It e mEv e nt . SELECTE D ) ? " se l e c t e d" : "u n se l e c t e d ") ); } pri va t e voi d j Ra di o Bu t t on4 _i t e mSt a t e Ch a n ge d ( It e mEve n t e ) { Sy st e m. o ut . pr i n t l n ( "\nj Ra d i o But t o n4_ i t e m St a t e Cha n ge d( It e mEve nt e ) c a l l e d . " ); Sy st e m. o ut . pr i n t l n ( " > > " + (( e . ge t St a t e Ch a n ge ( ) It e mEv e nt . SELECTE D) ? " se l e c t e d" : "u n se l e c t e d ") ); } pri va t e vo i d j Ra di o Bu t t on 5 _i t e m St a t e Ch a n ge d ( It e mEve n t e ) { Sy st e m. o ut . pr i n t l n ( "\nj Ra d i o Bu t t o n 5_ i t e m St a t e Cha n ge d( It e mEv e nt e ) c a l l e d. " ); Sy st e m. o ut . p r i nt l n ( " > > " + ((e . g e t St a t e Cha n ge ( ) It e mEv e nt . SELECTE D ) ? " se l e c t e d" : "u n se l e c t e d ") ); } pri va t e vo i d j Co mbo Box 1_a c t i on Pe r f o r me d ( Ac t i on Eve n t e ) { == == ==

90

A. E. S. Sy st e m. o ut . pr i n t l n ( "\nj Co mbo Box 1_a c t i o n Pe r fo r me d ( Ac t i on Eve nt e ) c a l l e d. " ); Ob j e c t o = j Co mbo Box 1. ge t Se l e c t e d It e m( ); Sy st e m. o u t . p r i n t l n ( " > > " o. t o St ri n g( )) + " i s se l e c t e d . ") ; } pr i va t e vo i d j But t o n1 _a c t i o nPe r fo r me d ( Ac t i o n Eve nt e ) { i n t a r rl e n = 10 000 ; byt e [ ] i n f i l e = n e w b y t e [a rr l e n ]; Fra me p a re n t = ne w Fra me () ; Fi l e Di a l o g fd = ne w F i l e Di a l o g( p a re n t , " Pl e a s e c h oo se a fi l e : ", Fi l e Di a l o g. LO AD) ; fd. sh o w() ; St ri n g se l e c t e d It e m = fd. g e t Fi l e () ; i f ( se l e c t e d It e m = = nu l l ) { } e l se { Fi l e f fi l e = ne w Fi l e ( fd . ge t Di re c t o r y( ) Fi l e . se pa ra t o r + fd. ge t Fi l e ( ) ); + + (( o = = nul l )? "n ul l " :

Sy st e m. o u t . p r i n t l n ( " re a di n g f i l e " + fd. ge t Di r e c t or y( ) + F i l e . se pa ra t o r + fd. ge t Fi l e ( ) ); try { Fi l e Inp u t St re a m f i s = ne w Fi l e Inp ut St re a m( f fi l e ) ; Bu f fe r e d In put St re a m b i s = n e wBu ffe re d Inp ut St re a m( f i s ) ; Da t a Inp ut St re a m d i s = n e w Da t a I n pu t St r e a m(b i s ); 91

A. E. S. try { i nt fi l e l e n gt h = d i s. re a d (i n f i l e ); St ri n g fi l e st ri n g = ne w St r i n g( i n fi l e , 0, fi l e l e n gt h ); Sy st e m. o ut . pr i n t l n ( " F ILE CO NTENT= " + fi l e st r i n g) ; } c a t c h ( IOExc e pt i o n i o x ) { Sy st e m. o ut . pr i n t l n ( " Fi l e r e a d e rr o r. . . " ); i ox. p r i n t St a c kTra c e ( ); } } c a t c h ( Fi l e No t F ou nd Ex c e p t i o n f nf ) { Sy st e m. o ut . pr i n t l n ( " Fi l e n ot fou nd . . . ") ; fn f. p ri n t St a c kTra c e ( ) ; } } } pr i va t e vo i d j But t o n2 _a c t i o nPe r fo r me d ( Ac t i o n Eve nt e ) { i n t a r rl e n = 10 000 ; byt e [ ] i n f i l e = n e w b y t e [a rr l e n ]; Fra me p a re n t = ne w Fra me () ; Fi l e Di a l o g fd = ne w F i l e Di a l o g( p a re n t , " Pl e a s e c h oo se a fi l e : ", Fi l e Di a l o g . LO AD) ; fd. sh o w() ; St ri n g se l e c t e d It e m = fd. g e t Fi l e () ; i f ( se l e c t e d It e m = = nu l l ) { 92

A. E. S. } e l se { Fi l e f fi l e = ne w Fi l e ( fd . ge t Di re c t o r y( ) Fi l e . se pa ra t o r + fd. ge t Fi l e ( ) ); / / r e a d t he f i l e Sy st e m. o u t . p r i n t l n ( " re a di n g f i l e " + fd. ge t Di r e c t or y( ) + Fi l e . se pa ra t o r + fd. ge t Fi l e ( ) ) ; try { Fi l e Inp u t St re a m f i s = ne w Fi l e Inp ut St re a m( f fi l e ) ; Buf fe re d In pu t St r e a m b i s = ne w Bu ffe re d Inp ut St re a m( f i s ) ; Da t a In put St re a m d i s = n e w Da t a In put St re a m( b i s ) ; try { i nt fi l e l e n gt h = d i s. re a d (i n f i l e ); St ri n g fi l e st ri n g = ne w St r i n g( i n fi l e , 0, fi le l e n g t h ); Sy st e m. o u t . p r i n t l n ( " F ILE CONTE NT= " + fi l e st ri n g); } c a t c h ( IOExc e pt i o n i o x ) { Sy st e m. o ut . pr i n t l n ( " Fi l e r e a d e rr o r. . . " ); i ox. p r i n t St a c kTra c e ( ); } } c a t c h ( Fi l e No t F ou nd Ex c e p t i o n f nf ) { Sy st e m. o ut . pr i n t l n ( " Fi l e n ot fou nd . . . ") ; fn f. p ri n t St a c kTra c e ( ) ; } } } 93 +

A. E. S. pr i va t e vo i d j But t o n3 _a c t i o nPe r fo r me d ( Ac t i o n Eve nt e ) { i n t a r rl e n = 10 000 ; byt e [ ] i n f i l e = n e w b y t e [a rr l e n ]; Fra me p a re n t = ne w Fra me () ; Fi l e Di a l o g fd = ne w F i l e Di a l o g( p a re n t , " Pl e a s e c h oo se a fi l e : ", Fi l e Di a l o g. LO AD) ; fd. sh o w() ; St ri n g se l e c t e d It e m = fd. g e t Fi l e () ; i f ( se l e c t e d It e m = = nu l l ) { } e l se { Fi l e f fi l e = ne w Fi l e ( Fi l e . se pa ra t o r + fd. g e t Fi l e () ); fd . ge t Di re c t o r y( ) +

Sy st e m. o u t . p r i n t l n ( " re a di n g f i l e " + fd. ge t Di r e c t or y( ) + Fi l e . s e pa ra t o r + fd. g e t Fi l e () ); try { Fi l e Inp ut St re a m f i s = ne w Fi l e In p ut St re a m( f fi l e ) ; Buf fe re d In pu t St r e a m b i s = ne w Bu ffe re d Inp ut St re a m( f i s ) ; Da t a In put St re a m d i s = n e w Da t a In put St re a m( b i s ) ; try { i n t fi l e l e n gt h = d i s. re a d (i n f i l e ); St ri n g fi l e st ri n g = ne w St r i n g(i n fi l e , 0, fi l e l e n gt h ); Sy st e m. o ut . pr i n t l n ( " F ILE CONTE NT= " + fi l e st ri n g); 94

A. E. S. } c a t c h ( IOEx c e p t i o n i ox ) { Sy st e m. o ut . pr i n t l n ( " Fi l e r e a d e rr o r. . . " ); i o x. pr i n t St a c kTra c e ( ); } } c a t c h ( Fi l e No t F o u nd Ex c e p t i o n f nf ) { Sy st e m. o ut . pr i n t l n ( " Fi l e n ot fou nd . . . ") ; f n f. p ri nt St a c kTra c e ( ) ; } } } publ i c st a t i c vo i d ma i n ( St ri n g[] a r gs ) { JF ra me . s e t De fa ul t Loo k An d Fe e l De c o ra t e d (t ru e) ; J Di a l o g. se t De fa u l t Lo o k An d Fe e l De c ora t e d (t r ue ) ; try { UIM a na ge r. se t Lo o k An dF e e l ( "c o m. su n. j a va . s wi n g. p l a f. wi n do ws. Wi n do ws Lo o k An dFe e l " ); } c a t c h ( Exc e pt i on e x ) { Sy st e m. o ut . pr i n t l n ( " Fa i l e d l o a di n g L&F: " ); Sy st e m. o ut . pr i n t l n (e x) ; } n e w c ryp t o 1( ); } } 95

A. E. S.

FUNCTI ON WI SE
Eng2Hex

i mp o rt j a va . i o. *; i mp o rt j a va . l a n g. * ; / ** Cl a s s c on ve r t s t he u se r f i l e t o b e e nc r yp t e d ( ASC II f o mra t ) t o i t s e qui va l e nt He x a- De c i ma l fo r ma t a s re qu i re d b y t he a ppl i c a t i o n. */ pub l i c c l a s s En g2 He x { Fi l e Inp ut St re a m f s t re a m; Da t a In put St re a m i n; int ch; int ch2; int length; Fi l e Out p ut St re a m o ut ; Pr i n t St r e a m p; voi d c o n ve rt ( St ri n g f i l e Na me ) { St ri n g He x =n e w St ri n g( ) ; 96

A. E. S. length=0; try { o ut = n e w Fi l e Ou t p ut St re a m( " i n t e r i m. t xt " ); p = n e w P r i nt St re a m( o ut ); / / he l p s t o p ri nt t he da t a i n f i l e wi t ho ut e xc e p t i on (c o pi e s t h e o r i gi na l d at a ) fst re a m = ne w F i l e Inp u t St re a m( fi l e Na me ); / / In pu t f i l e pa s s e d f o r ope ni n g i n = ne w Da t a Inpu t St re a m( f st re a m ); } c a t c h ( IOExc e p t i o n e ) { Sy st e m. o u t . p r i n t l n ( " Err or ope n i n g fi l e " ) ; } try { whi l e ( (c h = i n. re a d( ) ) != - 1 ) { He x = " \ 0 "; He x = t o He x (c h ); l e n gt h + = He x. l e n gt h( ); St ri n g re ve r se d = ne w St ri n g () ; fo r ( i n t i =0 ; i < He x. l e n gt h ( ); i + + ) { 97

A. E. S. re ve r se d = He x. su b st ri n g(i , i + 1 ) + re ve r se d ; } p. pr i n t ( re v e r se d ); } / / NOW IT IS REQUI RED TO AP P END SP ACES TO THE TEX T SO AS TO M AKE IT S LE NGTH A M ULT IP LE OF 3 2 i nt a dd i t i on s = 0; i f (l e n g t h %3 2 != 0 ) a dd i t i o n s =3 2- (l e n gt h %3 2 ); fo r( i n t i = 0 ; i < a dd i t i o n s; i + + ) { p. p r i n t ( " 2 0 " ); } p . c l o se ( ); i n. c l o se ( ) ; } c a t c h ( IOExc e p t i o n e ) { Sy st e m. o u t . p r i n t l n ( " Ex c e p t i o n r e a di n g c ha ra c t e r " ) ; } } St ri n g t o He x( i n t c h ) { i nt n =c h ; i nt i =0 ; i nt t ; 98

A. E. S. c h a r he x = '\ 0 '; St ri n g He x Te mp =n e w St ri n g( ) ; He x Te mp = " " ; wh i l e ( n >0 ) { t =n %1 6; n =n/ 16 ; s wi t c h( t ) { c a se (1 0) : { he x = ' A' ; b re a k; } c a se (1 1) : { he x = ' B' ; b re a k; } c a se (1 2) : { he x = ' C' ; b re a k; } c a se (1 3) : { he x = ' D'; b re a k; } c a se (1 4) : { he x = 'E' ; b re a k ; } c a se (1 5) : { he x = 'F '; b r e a k; } de fa ul t : } He x Te mp + = he x ; i + +; } i f (c h < 16 ) He x Te mp = He x Te mp + "0 "; re t u r n( He x Te mp ) ; } 99 { he x =( c ha r) ( t +4 8) ; b re a k; }

A. E. S. voi d t o En g( St ri n g f i l e Na me ) { St ri n g He x =n e w St ri n g( ) ; i nt c h1 = 0 ; try { St ri n g En g; out = n e w Fi l e Ou t p ut St re a m( f i l e N a me ); p = ne w Pr i n t St r e a m( o ut ); f st re a m = ne w Fi l e In p ut St re a m( " i n t e r i m. t xt " ) ; i n = ne w Da t a Inp u t St re a m( f st re a m ); whi l e ( (c h 1 = i n . re a d () ) != - 1 ) { c h2 = i n. re a d () ;

i nt no = 0; s wi t c h( c h1 ) { c a se (6 5) : { c h 1 =1 0 ; b re a k; } c a se (6 6) : { c h 1 =1 1 ; b re a k; } c a s e (6 7) : { c h 1 =1 2; b re a k ; } c a se (6 8) : { c h 1 =1 3 ; b re a k; } c a se (6 9) : { c h 1 =1 4 ; b re a k; } c a se (7 0) : { c h 1 =1 5 ; b re a k; } 100

A. E. S. c a se (9 7) : { c h 1 =1 0 ; b re a k; } c a se (9 8) : { c h 1 =1 1 ; b re a k; } c a se (9 9) : { c h 1 =1 2 ; b re a k; } c a se (1 00 ): { c h1 = 1 3; br e a k; } c a se (1 01 ): { c h1 = 1 4; br e a k; } c a se (1 02 ): { c h1 = 1 5; br e a k; } de fa ul t : } s wi t c h( c h2 ) { c a se (6 5) : { c h 2 =1 0 ; b re a k; } c a se (6 6) : { c h 2 =1 1 ; b re a k; } c a se (6 7) : { c h 2 =1 2 ; b re a k; } c a se (6 8) : { c h 2 =1 3 ; b re a k; } c a se (6 9) : { c h 2 =1 4 ; b re a k; } c a se (7 0) : { c h 2 =1 5 ; b re a k; } c a se (9 7) : { c h 2 =1 0 ; b re a k; } c a se (9 8) : { c h 2 =1 1 ; b re a k; } c a se (9 9) : { c h 2 =1 2 ; b re a k; } c a se (1 00 ): { c h2 = 1 3; br e a k; } c a se (1 01 ): { c h2 = 1 4; br e a k; } c a se (1 02 ): { c h2 = 1 5; br e a k; } de fa u l t : { c h 2 =c h 2- 48 ; b re a k; } { c h1 = c h 1- 48 ; br e a k; }

} no =c h2 +c h1 *16 ; 101

A. E. S. c ha r c hr = (c ha r) no ; p. p r i n t (c h r) ; } p. pr i n t ( ' \ 0 ') ; p. c l o se ( ); i n. c l o se ( ) ; } c a t c h ( IOExc e p t i o n e ) { Sy st e m. o u t . p r i n t ln ( " Ex c e p t i o n r e a di n g c ha ra c t e r " ) ; }}};

G e t B y te s

i mp o rt j a va . i o. *; / ** Ta ke s t he i np ut fr o m t he fi l e t o be e n c r yp t b l o c k b y b l o c k. */ pub l i c c l a s s Ge t By t e s { i n t fl a g = 0 ; i n t t e mp ; pr i va t e St r i n g f i l e na me ; pr i va t e i n t a r ra y Si z e ; pr i va t e Re a de r i n; pr i va t e Da t a Inp ut St re a m di s ; 102

A. E. S. / ** Ope n s t he fi l e t o be re a d . */ pub l i c Ge t Byt e s ( St ri n g f i l e , i nt n) { fi l e na me = f i l e ; a rr a y Si z e = n; try { i n = ne w F i l e Re a de r( f i l e na me ) ; } c a t c h ( IOExc e p t i o n e ) { Sy st e m. o u t . p r i n t l n ( " Ex c e p t i o n o p e ni n g " + f i l e na me ) ; } } / ** Re a d s t h e ne x t c ha ra c t e r of t h e fi l e . */ pr i va t e c ha r ge t Ne x t Cha r ( ) { c h a r c h = ' '; try { 103

A. E. S. i f (( t e mp = i n . r e a d () ) = = -1 ) { fl a g= 1 ; i n. c l o se ( ) ; } c h = (c h a r ) t e mp; } c a t c h ( IOExc e p t i o n e ) { Sy st e m. o u t . p ri n t l n ( " Ex c e p t i o n r e a d i n g c ha ra c t e r " ) ; } re t u r n c h ; } / ** Re t u rn s t he e q ui va l e nt He x a - De c i ma l o f t h e pa s se d ASC I I va l u e . */ pr i va t e i n t va l (c ha r c h ) { i f (c h > = '0 ' && c h < = ' 9' ) re t ur n c h - ' 0 ' ; i f (c h > = 'a ' && c h < = ' f' ) re t ur n c h - 'a ' + 1 0 ; i f (c h > = ' A' && c h < = ' F ') re t ur n c h - ' A' + 10; 104

A. E. S. re t u r n - 1 00 0 0 00 ; } / ** Re a d s t he ne xt t wo by t e s a s wr i t t e n i n t he f i l e s o a s t o ge t t he he xa de c i ma l v a l u e . */ pub l i c by t e [ ] ge t By t e s( ) { b yt e [ ] re t = ne w by t e [ a r ra y Si z e ]; fo r ( i n t i = 0 ; i < a r ra y Si z e ; i + + ) { c h a r c h 1 = ge t Ne xt Cha r ( ); i f (t e mp = = - 1) re t ur n re t ; c ha r c h2 = ge t Ne xt Cha r( ); i f (t e mp = = - 1) re t ur n re t ; re t [i ] = (b y t e )( va l (c h 1 )* 1 6 + va l (c h2) ) ; } re t u r n re t ; } / ** Ge t s t he n u mbe r o f t h re a d s fo r d e c ry p t i o n a s u se d d ur i n g e nc r y p t i o n. */ 105

A. E. S. pub l i c i nt ge t Thre a d () { i nt va l = 0; c h a r c h = ge t Ne x t Ch a r ( ); v a l = ( t e mp - 4 8) *10 0; c h = ge t Ne x t Cha r () ; v a l = va l + ( t e mp-48 )* 10 ; c h = ge t Ne x t Cha r () ; v a l = va l + ( t e mp-48 ) ; re t u r n ( va l ); } / ** Sh i f t s t he fi l e p oi nt e r t o t h e i n p ut fi l e a he a d by one b yt e . */ pub l i c vo i d sh i f t ( ) { try { t e mp =i n. re a d ( ) ; } c a t c h ( IOExc e p t i o n e ) { Sy st e m. o ut . pr i n t l n (e ); }}} 106

A. E. S.
PutBytes

i mp o rt j a va . i o. *; / ** Cl a s s t o wri t e t he e nc ryp t e d / d e c ry pt e d da t a i n t o t h e out pu t f i l e . */ pub l i c c l a s s P ut By t e s { pr i va t e s t a t i c fi n a l i n t Nb = 4 ; pr i va t e s t a t i c St ri n g[] di g = { " 0 ", "1 ", "2 ", " 3 ", "4 ", "5 ", " 6 ", "7 ", " 8", " 9 ", "a ", "b ", "c ", " d ", "e ", "f " }; pr i va t e Da t a Ou t p ut St re a m do s ; Fi l e Out p ut St re a m f s t re a m; Pr i n t St r e a m out ; / ** Ope n s t he fi l e t o be wri t t e n i n t o . */ pub l i c Pu t By t e s( St r i n g ou t f i l e ) { try { f st re a m= ne w F i l e Out pu t St re a m( ou t f i l e ); out = ne w P ri n t St re a m( f st re a m) ; } 107

A. E. S. c a t c h ( IOExc e p t i o n e ) { Sy st e m. o ut . pr i n t l n ( " Ex c e p t i o n Ca u gh t i n o pe n i n g f i l e : " + out fi l e ); } } / ** Ope n s f i l e t o be wri t t e n i nt o i n a ppe n d mode . */ pub l i c Pu t By t e s( St r i n g ou t f i l e , i nt fl a g) { try { f st re a m= ne w F i l e Out pu t St re a m( ou t f i l e ); f st re a m. c l o s e ( ); f st re a m= ne w F i l e Out pu t St re a m( ou t f i l e , t r ue ) ; out = ne w P ri n t St re a m( f st re a m) ; } c a t c h ( IOExc e pt i o n e ) { Sy st e m. o ut . pr i n t l n ( " Ex c e p t i o n Ca u gh t i n ope n i n g f i l e : " + out fi l e ); } } / ** Re t u rn s t he He x a - De c i ma l e q ui va l e nt . 108

A. E. S. */ pub l i c s t a t i c St r i n g he x (b yt e a ) { re t u r n d i g [ (a & 0x f f) > > 4] + d i g [ a & 0 x 0f ]; } / ** Wri t e s a o ne di me n sio na l a r ra y i nt o t h e o ut pu t f i l e . */ pub l i c vo i d pu t (b y t e [] re t ) { fo r ( i n t i = 0 ; i < re t . l e n gt h; i + + ) { out . pr i n t ( he x (r e t [i ] )) ; } }

/ ** Wri t e s a o ne di me n s i on a l a r ra y i n t o t h e o ut pu t fi l e fo r a se t nu mbe r o f t hre a d s. */ pub l i c vo i d pu t (by t e [] re t , i n t t h ) { fo r ( i n t i = 0 ; i <1 6 *t h; i + + ) { out . pr i n t ( he x (r e t [i ] )) ; } } 109

A. E. S. / ** Wr i t e s a t wo 0d i me n si ona l a r ra y i n t o t he ou t p ut fi l e . */ pub l i c vo i d pu t (b y t e [] [ ] re t ) { fo r ( i n t c = 0; c < Nb; c + + ) { fo r ( i n t r = 0 ; r < 4 ; r + + ) { ou t . p r i n t ( he x (r e t [r ] [c ]) ); } } } / ** Wri t e s t h e nu mbe r o f t h re a d s u se d du r i n g e nc ry pt i on i n t o t he o ut put fi l e . */ pub l i c vo i d pu t (i n t t hre a d ) { o ut . pr i n t ( t h re a d ) ; } }

110

A. E. S.

A E S ta b l e s

** Th i s c l a s s i s t he ba c ke n d of t h e a p pl i c a t i on . It i ni t i a l i ze s t he SBo x and ot he r vi t a l a r ra y s and ha s all t he ba c kg r o un d c o mp ut a t i on. */ pub l i c c l a s s AESt a b l e s { pub l i c AE St a bl e s( ) { l oa d E( ); l oa d L( ) ; l oa d In v ( ) ; l oa d S( ) ; l oa d In v S( ); l oa d P o wX( ); } pr i va t e by t e [] E = ne w by t e [2 5 6] ; pr i va t e by t e [] L = ne w by t e [25 6] ; pr i va t e by t e [] S = ne w b y t e [ 25 6] ; 111

A. E. S. pr i va t e by t e [] i n vS = ne w by t e [2 5 6] ; The ro un d c on s t a n t wo rd a r ra y. */ pub l i c by t e Rc on ( i nt i ) { re t u r n p o wX[ i -1 ]; } pub l i c by t e F F Mu l F a s t (by t e a , b y t e b) { i nt t = 0; i f (a = = 0 | | b = = 0 ) re t ur n 0; t = ( L[ (a & 0x f f) ] & 0x f f) + ( L[ (b & 0x f f) ] & 0x ff ) ; i f (t > 2 5 5 ) t = t - 25 5; re t ur n E[ (t & 0x f f) ]; }

pub l i c by t e F F Mu l ( by t e a , b y t e b ) { b yt e a a = a , b b = b, r = 0, t ;

112

A. E. S. wh i l e (a a != 0 ) { i f ((a a & 1 ) != 0) r = ( b yt e ) ( r ^ b b ) ; t = (b yt e ) (b b & 0 x8 0 ) ; bb = ( by t e ) (b b < < 1 ); i f (t != 0 ) bb = ( by t e ) (b b ^ 0x 1 b) ; a a = (b y t e ) ((a a & 0 xf f ) > > 1 ); } re t u r n r ; } pr i va t e vo i d l o a d E( ) { b yt e x = ( by t e ) 0x0 1; i nt i nd e x = 0 ; E[i n de x + + ] = (b yt e )0 x0 1 ; fo r ( i n t i = 0 ; i < 25 5; i + + ) { byt e y = F F Mu l ( x, ( byt e ) 0 x 03 );

113

A. E. S. E[i n de x + + ] = y ; x = y; } } pr i va t e vo i d l o a d L( ) { i nt i nd e x; fo r ( i n t i = 0 ; i < 25 5; i + + ) { L[ E[ i ] & 0 x f f] = (b yt e )i ; } } pr i va t e vo i d l o a d S( ) { i nt i nd e x; fo r ( i n t i = 0 ; i < 25 6; i + + ) S[ i ] = (b yt e ) ( sub Byt e s( (b y t e ) (i & 0x f f ) ) & 0 xf f ); } pr i va t e vo i d l o a d In v( ) {

114

A. E. S. i nt i nd e x; fo r ( i n t i = 0 ; i < 25 6; i + + ) i n v[i ] = (by t e )( F F In v ( (b y t e )( i & 0 xf f) ) & 0x f f) ; } pr i va t e vo i d l o a d In v S( ) { i nt i nd e x; fo r ( i n t i = 0 ; i < 2 5 6; i + + ) { i n vS[ S[ i ] & 0x f f] = (b y t e )i ; } } pr i va t e vo i d l o a d P o wX( ) { i nt i nd e x; b yt e x = ( by t e ) 0x0 2; b yt e xp = x ; p o wX[ 0] = 1 ; p o wX[1 ] = x ; fo r ( i n t i = 2 ; i < 15 ; i + + ) {

115

A. E. S. xp = F F M ul (xp, x) ; po wX[ i ] = xp; } } pub l i c byt e F F In v (b y t e b ) { b yt e e = L[ b & 0 x f f] ; re t u r n E[ 0x ff - (e & 0 xf f )] ; } pub l i c i nt i t h Bi t ( by t e b, i n t i ) { i n t m[ ] = { 0 x 01, 0 x 02 , 0x 04, 0 x0 8, 0x 10, 0x 2 0, 0x 4 0, 0x8 0} ; re t u r n (b & m[ i ] ) > > i ; } pub l i c i nt s u b Byt e s (b yt e b ) { b yt e i n B = b ; i nt re s = 0 ; i f (b != 0 ) b = (b yt e ) (F F In v ( b) & 0x f f) ; 116

A. E. S. b yt e c = (b yt e )0 x6 3; fo r ( i n t i = 0 ; i < 8; i + + ) { i nt t e mp = 0; t e mp = i t h Bi t (b, i ) ^ i t h Bi t ( b, (i + 4) %8 ) ^ i t h Bi t (b, ( i +5 ) %8 ) ^ i t h Bi t (b, (i + 6) % 8) ^ i t h Bi t (b, ( i +7 ) %8 ) ^ i t h Bi t (c ,i ); re s = re s | (t e mp < < i ) ; } re t u r n re s ; } } pr i va t e by t e [] i n v = ne w b y t e [2 56 ] ; pr i va t e by t e [] p o wX = ne w byt e [ 1 5] ; / ** Re t u rn s t he re qu i re d va l u e of t h e S- Bo x */ pub l i c by t e SBox (b yt e b ) { re t u r n S[b & 0x f f] ; } / ** 117

A. E. S. Re t u rn s t he re qu i re d va l u e of t he I n ve r se S- Bo x */ pub l i c by t e In v SBo x( byt e b) { re t ur n i n vS[ b & 0 x f f ]; }


AESencrypt

/ ** Th e ma i n i mpl e me nt a t i o n o f t he AES a l g o ri t h m re si de s i n t hi s c l a s s. */ pub l i c c l a s s AESe nc ry pt { pr i va t e f i na l i n t Nb = 4; / / b l oc k s i z e pr i va t e i n t Nk; pr i va t e i n t Nr; pr i va t e i n t wCoun t ; pr i va t e AESt a b l e s t a b; pr i va t e by t e [] w; / ** In i t i a l i z e s t he va ri a bl e s o f Nu mbe r o f r o u nd s, ke y si z e a n d ot he r v i t a l pa ra me t e r s. */ pub l i c AE Se nc r y p t ( by t e [ ] ke y, i n t NkIn ) { Nk = NkIn ; 118 / / ke y si z e / / ro un d s

A. E. S. Nr = Nk + 6; t a b = ne w AESt a b l e s () ; w = ne w b yt e [4 * Nb * ( Nr +1 ) ]; Ke y Ex pa n s i on ( ke y, w); } / ** Th i s i s t he a c t ua l e nc r yp t i on f un c t i o n of AE S. Ca l l s a l l t h e re q u i si t e fun c t i on s. * / pub l i c vo i d Ci ph e r (by t e [] i n, by t e [] ou t ) { wCou nt = 0 ; b yt e [ ][ ] st a t e = n e w by t e [4 ][ Nb ]; Cop y. c op y( s t a t e , i n ); Ad d Rou nd Ke y ( st a t e ) ; fo r ( i n t ro un d = 1; ro un d < Nr ; r ou nd + + ) { // st a t e ); Su b By t e s( s t a t e ) ; Sh i f t Ro ws ( s t a t e ); M i x Col u mn s ( st a t e ); Ad d Ro u nd Ke y ( st a t e ) ; 119 Pr i n t . p ri n t Ar r a y ( " St a rt r ou nd " + r ou n d + ": " ,

A. E. S. } // Pr i n t . p ri n t Ar r a y ( " St a rt ro und " + Nr + ": ", st a t e ); Su b By t e s( s t a t e ) ; Sh i f t Ro ws ( s t a t e ); Ad d Rou nd Ke y ( st a t e ) ; Cop y. c op y( ou t , s t a t e ); } / ** -- De p re c a t e d - */ pub l i c vo i d Ci ph e r (by t e [] i n, by t e [] ou t , i nt t h rea d ) { wCou nt = 0 ; b yt e [ ][ ] st a t e = ne w by t e [4 ][ Nb ]; Cop y. c op y( s t a t e , i n ); Ad d Rou nd Ke y ( st a t e ) ; fo r ( i n t ro un d = 1; ro un d < Nr ; r ou nd + + ) { // Pr i n t . p ri n t Ar r a y ( " St a rt ro und " + rou nd + " : ", s t a t e ) ; Su b By t e s( s t a t e ) ;

120

A. E. S. Sh i f t Ro ws ( s t a t e ); M i x Col u mn s ( st a t e ); Ad d Rou nd Ke y ( st a t e ) ; } // Pr i n t . p ri n t Ar r a y ( " St a rt ro und " + Nr + ": ", st a t e ); Su b By t e s( s t a t e ) ; Sh i f t Ro ws ( s t a t e ); Ad d Rou nd Ke y ( st a t e ) ; Cop y. c op y( ou t , s t a t e , t h re a d ); } / ** Th i s i s t he d e c r yp t i on f unc t i on of AES. Ca l l s a l l t h e re q u i si t e fun c t i on s. */ pub l i c vo i d In vCi p he r (b y t e [ ] i n, b yt e [] out ) { wCou nt = 4 * Nb* ( Nr +1 ); b yt e [ ][ ] st a t e = ne w by t e [4 ][ Nb ]; Cop y. c op y( s t a t e , i n ); In v Ad d Ro und Ke y ( st a t e ); fo r ( i n t ro un d = Nr- 1; rou nd > = 1; rou nd-- ) 121

A. E. S. { // Pr i n t . p ri n t Ar r a y ( " St a rt r ou n d " + ( Nr - ro un d) + ": " ,

st a t e ); In vSh i ft Ro ws ( st a t e ); In vSu b Byt e s ( st a t e ); In v Ad d Ro und Ke y ( st a t e ); In vM i x Col u mn s (s t a t e ) ; // Pr i n t . p ri n t Ar r a y ( " St a rt ro und " + Nr + ": ", st a t e ); In vSh i ft Ro ws ( st a t e ); In vSu b Byt e s ( st a t e ); In v Ad d Ro und Ke y ( st a t e ); Cop y. c op y( ou t , s t a t e ); } / ** -- De p re c a t e d - */ pub l i c voi d In v Ci p h e r (b yt e [ ] i n, b y t e [] ou t , i nt t h re a d ) { wCou nt = 4 * Nb* ( Nr +1 ); b yt e [ ][ ] st a t e = ne w by t e [4 ][ Nb ]; Cop y. c op y( s t a t e , i n ); 122

A. E. S. In v Ad d Ro und Ke y ( st a t e ); fo r ( i n t ro un d = Nr- 1; rou nd > = 1; rou nd-- ) { // Pr i n t . p ri n t Ar r a y ( " St a rt r ou n d " + ( Nr - ro un d) + ": " ,

st a t e ); In vSh i ft Ro ws ( st a t e ); In vSu b Byt e s ( st a t e ); In v Ad d Ro und Ke y ( st a t e ); In vM i x Col u mn s (s t a t e ) ; } // Pr i n t . p ri n t Ar r a y ( " St a rt ro und " + Nr + ": ", st a t e ); In vSh i ft Ro ws ( st a t e ); In vSu b Byt e s ( st a t e ); In v Ad d Ro und Ke y ( st a t e ); Cop y. c op y( ou t , s t a t e , t h re a d ); } / ** Th e AES a l go r i t h m t a ke s t he Ci p he r Ke y, K, a nd pe r fo r ms a Ke y Expa n si on r o u t i n e t o ge ne ra t e a ke y sc he du l e . The Ke y Ex pa n s i on ge ne ra t e s a t ot a l o f Nb ( Nr + 1 ) wo rd s : t h e a l go r i t h m re qu i re s a n i ni t i a l s e t of Nb wor d s, a nd e a c h of t he Nr r ou n d s re q ui re s Nb wor d s of ke y da t a . Th e re su l t i n g ke y sc h e du l e c on si s t s o f a l i ne a r a r ra y of 4 - b yt e wo rd s, de n ot e d [ w i ], wi t h i i n t h e ra n ge .0 < = i < Nb( Nr + 1 ). * / 123

A. E. S. pr i va t e vo i d Ke y Ex pa n s i on (b y t e[ ] ke y, by t e [] w) { b yt e [ ] t e mp = n e w b yt e [4 ]; i nt j = 0, i =0 ; wh i l e ( j < 4* Nk ) { w[j ] = ke y [j + + ]; } wh i l e ( j < 4 * Nb *( Nr + 1 )) { i = j / 4; fo r ( i n t i Te mp = 0 ; i Te mp < 4 ; i Te mp + + ) t e mp[ i Te mp] = w[ j- 4 +i Te mp ] ; i f (i % Nk = = 0 ) { by t e t t e mp, t Rc o n; by t e o l d t e mp 0 = t e mp [0 ]; fo r ( i n t i Te mp = 0 ; i Te mp < 4 ; i Te mp + + ) { i f (i Te mp = = 3 )

124

A. E. S. t t e mp = o l d t e mp0 ; e l se t t e mp = t e mp [i Te mp + 1] ; i f (i Te mp = = 0 ) t Rc o n = t a b. Rc on (i / Nk) ; e l se t Rc o n = 0; t e mp [ i Te mp] = (b yt e ) (t a b. SBox (t t e mp ) ^ t Rc o n) ; } } e l se i f ( Nk > 6 && (i % Nk) = = 4) { fo r ( i n t i Te mp = 0 ; i Te mp < 4 ; i Te mp + + ) t e mp[ i Te mp] = t a b. SBo x ( t e mp [i Te mp ]) ; } fo r ( i n t i Te mp = 0 ; i Te mp < 4 ; i Te mp + + ) w[j + i Te mp ] = ( by t e ) ( w[ j - 4 * Nk + i Te mp ] ^ t e mp [i Te mp ]) ; j = j + 4; } } / **

125

A. E. S. Tra n s fo r ma t i on i n t h e Ci p h e r t h a t p roc e s se s t he St a t e us i n g a no nl i n e a r b yt e su bs t i t u t i o n t a bl e ( S- b o x) t ha t ope ra t e s on e a c h of t he St a t e b yt e s i nde pe n d e nt l y. */ pr i va t e vo i d Su b By t e s( b y t e [ ] [] s t a t e ) { fo r ( i n t ro w = 0 ; ro w < 4; ro w+ + ) { fo r ( i n t c ol = 0; c o l < Nb ; c o l + + ) { st a t e [r o w] [c o l ] t a b. SBox ( s t a t e [ ro w] [c o l ] ) ; } } } / ** Is t he i n ve r se o f t he b yt e s ub s t i t ut i on t ra n sf o r ma t i on, i n whi c h t h e i n ve rs e Sbo x i s a p p l i e d to e a c h by t e o f t he St a t e . * / pr i va t e vo i d In vSu b By t e s (b yt e [ ][ ] st a t e ) { fo r( i n t r o w = 0 ; r o w < 4 ; r o w+ + ) { 126 =

A. E. S. fo r( i n t c o l = 0; c ol < Nb ; c o l + + ) { st a t e [r o w] [c o l ] = t a b. In vSBo x ( st a t e [r o w] [c o l ] ); } } } / ** Tra n s fo r ma t i on i n t he Ci p h e r t ha t p roc e ss e s t he St a t e b y c yc l i c a l l y shi f t i n g t he l a s t t h re e r o ws o f t h e St a t e by di f fe r e n t of f se t s. */ pr i va t e vo i d Sh i f t Ro ws ( by t e [ ] [] s t a t e ) { b yt e [ ] t sh i ft = n e w by t e [4 ]; fo r ( i n t r = 1 ; r < 4 ; r + + ) { fo r ( i n t c = 0; c < Nb ; c + + ) t s h i ft [c ] = st a t e [ r ][ (c + r) % Nb ]; fo r ( i n t c = 0; c < Nb ; c + + ) st a t e [r ] [c ] = t sh i f t [ c ] ; } 127

A. E. S. } / ** In ve r se of t he Shi f t Ro ws ( ) t ra n s fo r ma t i on. The b yt e s i n t he l a s t t hre e r o ws o f t he St a t e a re c yc l i c a l l y sh i f t e d o ve r di ffe re nt n u mbe rs of b yt e s (o f f se t s ). */ pr i va t e vo i d In vSh i ft Ro ws (b yt e [] [ ] s t a t e ) { b yt e [ ] t sh i ft = n e w by t e [4 ]; fo r ( i n t r = 1 ; r < 4 ; r + + ) { fo r ( i n t c = 0; c < Nb ; c + + ) t s h i ft [c ] = st a t e [ r ][ ( Nb - ( r -c ) ) % Nb] ; fo r ( i n t c = 0; c < Nb ; c + + ) st a t e [r ] [c ] = t sh i f t [ c ] ; } } / ** The M i x Col u mn s( ) t ra n sf or ma t i o n o pe ra t e s o n t he St a t e c ol u mn - by -c o l u mn, GF (2 ^8 ) { 0 2} . 128 a nd t re a t i n g each c o l u mn x ^4 + as 1 a wi t h fou r - t e r m a f i xe d pol yn o mi a l . The c o l u mn s a re c o n si d e re d a s po l y no mi a l s o ve r mul t i p l i e d mo d u l o pol yn o mi a l a (x ), gi ve n b y a (x ) = { 03} x^ 3 + { 01} x^ 2 + { 0 1} x +

A. E. S. */ pr i va t e vo i d M i x Col u mn s (b y t e [ ][ ] s ) { i nt [ ] s d a sh = ne w i nt [4 ]; b yt e b02 = (b yt e )0 x0 2 , b0 3 = (b yt e )0 x03 ; fo r ( i n t c = 0; c < 4 ; c + + ) {

sd a s h [0 ] =t a b. F F Mu l (b0 2, s[ 0 ] [c ] )^ t a b. FF M ul (b 03, s [1 ][c ] ) ^ s [2 ] [c ] ^ s [3 ][c ] ; sd a s h [1 ] = s[ 0] [c ] ^t a b. F F Mu l ( b0 2, s [1 ][ c ] ) ^ t a b. FF M ul (b 03, s [2 ][c ] ) ^ s [3 ][ c ] ; sd a s h [2 ] = s[ 0] [c ] ^ s[ 1] [c ] ^ t a b. F F Mu l ( b0 2 , s [2 ] [c ]) ^ t a b. FF M ul (b 03, s [3 ][c ] ); sd a s h [3 ] = t a b . F F M ul (b 0 3, s[ 0] [c ] ) ^ s [1 ] [c ] ^ s [2 ] [c ] ^ t a b. FF M ul (b 02, s [3 ][c ] ); fo r ( i n t i = 0 ; i < 4; i + + ) s [i ][ c ] = (b y t e )( s da sh [i ] ); } } / ** The i n ve r se of t he M i x Co l u mn s ( ) t ra n s fo r ma t i on. 129

A. E. S. */ pr i va t e vo i d In vM i x Co l u mn s (by t e [ ][ ] s) { i nt [ ] s d a sh = ne w i nt [4 ]; byt e b0 e = (b yt e )0 x0e , b 09 = (b yt e )0x 09, b0 d = (b yt e )0 x0d , b0b = (b yt e )0 x0b ; fo r ( i n t c = 0; c < 4 ; c + + ) { sd a s h [0 ] =t a b. F F Mu l (b0 e , s [0 ] [c ]) ^ t a b . F F Mu l ( b0 b, s [1 ] [c ]) ^ t a b . F F Mu l ( b0 d, s [2 ] [c ]) ^ t a b. F F M u l (b0 9 , s[ 3] [c ] ); sd a s h [1 ] = t a b . F F Mu l (b 0 9, s[ 0] [c ] ) ^ t a b. F F Mu l ( b 0e , s [1 ][ c ] ) ^ t a b . F F Mu l ( b0 b, s [2 ] [c ]) ^ t a b. F F M u l (b0 d , s[ 3] [c ] ); sd a s h [2 ] = t a b . F F Mul (b0 d , s[ 0] [c ] ) ^ t a b . F F M ul (b 09, s[ 1] [c ] ) ^ t a b . F F Mu l ( b0e , s [2 ][ c ] ) ^ t a b. FF M ul (b0 b, s[ 3 ] [c ] ); sd a s h [3 ] = t a b . F F Mu l (b 0 b, s[ 0] [c ] ) ^ t a b. F F M ul (b 0d, s[ 1 ] [c ] ) ^ t a b . F F Mu l ( b0 9, s [2] [c ]) ^ t a b . F F M ul (b0 e , s [3 ] [c ]) ; fo r ( i n t i = 0 ; i < 4; i + + ) s [i ][ c ] = (b yt e )( s da s h [i ] ); } } / **

130

A. E. S. Roun d Ke y i s a dde d t o t h e St a t e b y a si mp l e bi t wi se XO R ope ra t i on. Ea c h Ro und Ke y c o n s i st s o f Nb wo rd s f ro m t he ke y sc h e du l e . */ pr i va t e vo i d Ad d Rou n d Ke y (by t e [] [] s t a t e ) { fo r ( i n t c = 0; c < Nb; c + + ) { fo r ( i n t r = 0 ; r < 4 ; r ++ ) { st a t e [r ] [c ] = ( b yt e ) ( st a t e [r ] [c ] ^ w[ wCoun t + + ] ); } } } pr i va t e vo i d In v Ad d Ro un d Ke y (b yt e [] [ ] st a t e ) { fo r ( i n t c = Nb - 1; c > = 0; c-- ) { fo r ( i n t r = 3 ; r > = 0 ; r- - ) { st a t e [r ] [c ] = ( b yt e ) ( st a t e [r ] [c ] ^ w[ - - wCou nt ] ); }} } }

131

A. E. S.
AESecbmulti

/ / 1 28- b i t u se 1 6, 16 , a n d 4 be l o w / / 1 92- b i t u se 1 6, 24 a nd 6 be l o w / / 2 56- b i t u se 1 6, 32 a nd 8 be l o w i mp o rt j a va . i o. *; pub l i c c l a s s AESe c b mu l t i { st a t i c AESe nc ry pt a e s2, a e s 3; st a t i c NTh re a d e c b n t 1, n t 2, nt 3 ; st a t i c b y t e [ ] o ut 2; st a t i c b y t e [ ] o ut 3; pub l i c s t a t i c vo i d ma i n ( St r i n g[ ] a r gs ) t hr o ws IOExc e pt i o n { St ri n g fi l e , ke y f i l e , e n c de c , o u t fi l e , i ni t ve c f i l e ; i nt fl a g= 1, n u mb i t s =1 , t h = 0; b yt e [ ] i n ; l on g s t a rt , e n d; Buf fe re d Re a de r b r = Inp ut St re a mRe a de r ( Sy s t e m. i n ) ); whi l e ( fl a g> 0 ) { Sy st e m. o ut . pr i n t l n ( " 1. Enc r y p t i o n " ); Sy st e m. o ut . pr i n t l n ( " 2. De c ryp t i on " ); e nc de c = b r. re a d Li n e ( ); Sy st e m. o ut . pr i n t l n ( " " ); fl a g = Int e ge r. pa r se In t (e nc de c ); i f (f l a g= = 1 | | fl a g= = 2 ) 132 ne w Buf fe re d Re a d e r (ne w

A. E. S. b re a k; e l se { Sy s t e m. ou t . p r i n t l n ( " Er ron ou s In p ut . . . t ry a ga i n. . " ); fl a g= 1; } } w hi l e ( nu mb i t s > 0) { Sy s t e m. ou t . p ri n t l n( " 1. 128-b i t " ); Sy s t e m. ou t . p ri n t l n( " 2. 192-b i t " ); Sy st e m. o ut . pr i n t l n ( " 3. 256- bi t " ) ; e nc de c = b r. re a d Li n e ( ); nu mbi t s = In t e g e r. pa r s e In t (e nc de c ); i f (n u mbi t s = = 1 ) { nu mb i t s =4 ; bre a k; } e l se i f( nu mb i t s = = 2)

133

A. E. S. { numb i t s = 6 ; bre a k; } e l se i f (nu mb i t s = = 3 ) { nu mb i t s = 8; bre a k; } e l se { Sy st e m. o ut . p ri nt l n ( " Er ro ne ou s a ga i n ") ; Sys t e m. ou t . p ri nt l n ( " " ); nu mb i t s = 1; } } Sy st e m. o u t . p r i n t l n ( " En t e r f ul l pa t h of t he fi l e : " ); fi l e = b r. re a d Li ne ( ); Sy st e m. o u t . p r i n t l n ( " " ); Sy st e m. o u t . p r i n t l n ( " " ); 134 Inp ut . . . . t r y

A. E. S. Sy st e m. o u t . p r i n t l n ( " En t e r fu l l pa t h of ke y fi l e ") ; k e y fi l e = b r. re a d Li n e ( ); Sy st e m. o u t . p r i n t l n ( " " ); Sy st e m. o u t . p r i n t l n ( " " ); Sy st e m. o u t . p r i n t l n ( " En t e r pa t h o f out pu t f i l e : " ) ; o ut fi l e = b r. r e a d Li ne () ; En g2 He x e n g = ne w En g2 He x ( ); i f (f l a g= = 1 ) { e n g. c o n ve rt ( fi l e ) ; } Pu t By t e s p u t f i l e ; Ge t Byt e s ge t Inp ut ; i f (f l a g= = 1 ) { put fi l e = ne w P ut By t e s (o ut fi l e ); ge t In p ut = ne w Ge t By t e s( " i n t e r i m. t xt ", 16 );

} e l se { 135

A. E. S. put fi l e = ne w P ut By t e s ( "i n t e ri m. t x t ", 1 ) ; ge t Inp ut = ne w Ge t By t e s (f i l e , 1 6 ); } st a r t = Sy st e m. c u rr e nt Ti me Mi l l i s ( ); Ge t Byt e s nu mbi t s* 4 ) ; b yt e [ ] ke y = ge t Ke y. ge t By t e s ( ); AE Se n c r yp t a e s1 = ne w AE Se nc ry pt ( ke y, nu mbi t s ); i f (f l a g!= 1 ) { a e s 2 = ne w AESe nc r y p t ( ke y , n u mb i t s ); a e s 3 = ne w AESe nc r y p t ( ke y , n u mb i t s ); out 2 = ne w by t e [ 1 6 ]; out 3 = ne w by t e [ 1 6 ]; } b yt e [ ] o u t 1 = n e w b yt e [1 6] ; Pr i n t . p ri n t Ar r a y ( " Ke y: wh i l e ( g e t In pu t . f l a g!= 1 ) { i n = ge t Inp ut . ge t By t e s () ; i f ( ge t Inp u t . fl a g != 1 ) 136 ", k e y) ; ge t Ke y = new Ge t Byt e s ( ke y fi l e ,

A. E. S. { Sy st e m. o ut . pr i n t ( " " ); i f (f l a g= = 1 ) { Pr i n t . p ri n t Ar r a y ( " Pl a i n t e xt : a e s 1 . Ci p h e r( i n, o ut 1) ; Pr i n t . p ri n t Ar r a y ( " Ci phe r t e x t : put fi l e . p ut (o ut 1 ) ; } e l se { t h =0 ; nt 1 = ne w NTh re a de c b( " One ", i n, a e s1, o ut 1 ); i f ( ge t Inp ut . fl a g!= 1 ) { i n = ge t Inp ut . ge t By t e s () ; i f ( ge t Inp ut . fl a g!= 1 ) { nt 2 = ne w NTh re a de c b( " Two ", i n , a e s2 , out 2 ); th++; ", out 1) ; ", i n) ;

137

A. E. S. } }

i f ( ge t In p ut . fl a g!= 1 ) { i n = ge t Inp ut . ge t By t e s () ; i f ( ge t Inp ut . fl a g!= 1 ) { nt 3 = ne wNTh re a de c b ( " Th re e ", i n , a e s3 , out 3 ); th++; } } try { Sy st e m. o u t . p r i n t l n ( " Wa i t i n g f or t h re a d s t o f i n i sh. " ); nt 1. t . j o i n () ; put fi l e . p ut (o ut 1 ) ; i f (t h > =1 ) { n t 2. t . j o i n () ;

138

A. E. S. p ut fi l e . p ut (o u t 2 ) ; } i f (t h = =2 ) { n t 3. t . j o i n () ; p ut fi l e . p ut (o u t 3 ) ; } } c a t c h ( Int e r ru pt e dExc e p t i on e ) { Sy st e m. o ut . pr i n t l n ( " Ma i n t h re a d I nt e rr up t e d " ); } } } } e n d = Sy st e m. c u r re n t Ti me Mi l l i s( ); i f (f l a g != 1 ) { e n g. t o En g(o ut fi l e ); }

139

A. E. S.

Sy st e m. o ut . pr i n t l n ( " Ex e c u t i o n t i me i s } }

: " + (e nd - st a rt ) );

NThreadecb

c l a s s NTh re a d e c b i mp l e me n t s Ru n na b l e { // St ri n g na me ; / / n a me of t h re a d Th re a d t ; AE Se n c r yp t t a e s ; byt e [ ] t i n; byt e [ ] t o ut ; NThre a d e c b ( St r i n g a e s, b yt e [ ] o u t ) { // n a me = t h re a d na me ; t i n = ne w b y t e [1 6] ; Sy st e m. a r ra yc opy ( i n, 0, t i n, 0, i n . l e n gt h ); t ou t = ou t ; 140 t h re a dn a me , byt e [ ] i n, AESe nc ryp t

A. E. S. t a e s =a e s; t = ne w Th re a d( t h i s, t h re a d na me ) ; Sy st e m. o u t . p r i n t l n ( " Ne w t hr e a d : " + t ); t . s t a r t () ; / / St a r t t h e t h re a d } / / Ent r y po i n t fo r t hr e a d . pub l i c vo i d r un () { try { Pr i n t . p ri n t Ar r a y ( " Ci ph e r t e x t : t a e s. In vCi ph e r (t i n , t o u t ) ; Pr i n t . p ri n t Ar r a y ( " Pl a i n Te x t : } c a t c h ( Exc e pt i on e ) { Sy st e m. o ut . p r i n t l n ( " i nt e r ru pt e d. ") ; } Sy st e m. o u t . p r i n t l n ( " Th re a d En d s. . . . ") ; }} ", t out ); ", t i n );

141

A. E. S.

A E S te s tc b c

/ / 1 28- b i t u se 1 6, 16 , a n d 4 be l o w / / 1 92- b i t u se 1 6, 24 a nd 6 be l o w / / 2 56- b i t u se 1 6, 32 a nd 8 be l o w i mp o rt j a va . i o. *; pub l i c c l a s s AESt e st c bc { pub l i c s t a t i c voi d ma i n( St r i n g[ ] a r gs ) t hr o ws IOExc e pt i o n { St ri n g fi l e , ke y f i l e , e n c de c , o u t fi l e , i ni t ve c f i l e ; i nt fl a g= 1, n u mb i t s =1 ; b yt e [ ] i n ; b yt e [ ] i v; l on g s t a rt , e n d; Bu f fe re d Re a de r b r =n e w Bu f fe r e d Re a d e r ( ne w Inp ut St re a mRe a de r( Sy s t e m. i n ) ); whi l e ( fl a g> 0 ) { Sy st e m. o ut . pr i n t l n ( " 1. Enc r y p t i o n " ); Sy st e m. o ut . pr i n t l n ( " 2. De c ryp t i on " ); 142

A. E. S. e nc de c = b r. re a d Li n e ( ); Sy st e m. o ut . pr i n t l n ( " " ); fl a g = Int e ge r. pa r se In t (e nc de c ); i f (f l a g= = 1 | | fl a g= = 2 ) b re a k; e l se { Sy s t e m. ou t . p r i n t l n ( " Er ron ou s In p ut . . . t ry a ga i n. . " ); fl a g= 1; } } wh i l e ( n u mb i t s > 0) { Sy s t e m. ou t . p ri n t l n( " 1. 128-b i t " ); Sy s t e m. ou t . p ri n t l n( " 2. 192-b i t " ); Sy st e m. o ut . pr i n t l n ( " 3. 256- bi t " ) ; e nc de c = b r. re a d Li n e ( ); nu mbi t s = In t e g e r. pa r s e In t (e nc de c ); i f (n u mbi t s = = 1 ) {

143

A. E. S. nu mb i t s =4 ; bre a k; } e l se i f( nu mb i t s = = 2) { numb i t s = 6 ; bre a k; } e l s e i f (n u mb i t s = = 3 ) { nu mb i t s = 8; bre a k; } e l se { Sy s t e m. ou t . p r i n t l n ( " Er ron e ou s In p ut . . . . t ry a ga i n " ) ; Sys t e m. ou t . p ri nt l n ( " " ); nu mb i t s = 1; } }

144

A. E. S. Sy st e m. o u t . p r i n t l n ( " En t e r f ul l pa t h of t he fi l e : " ); fi l e = b r. re a d Li ne ( ); Sy st e m. o u t . p r i n t l n ( " " ); Sy st e m. o u t . p r i n t l n ( " " ); Sy st e m. o u t . p r i n t l n ( " En t e r f ul l pa t h of ke y fi l e ") ; k e y fi l e = b r. re a d Li n e ( ); Sy st e m. o u t . p r i n t l n ( " " ); Sy st e m. o u t . p r i n t l n ( " " ); Sy st e m. o u t . p r i n t l n ( " En t e r pa t h o f out pu t f i l e : " ) ; o ut fi l e = b r. r e a d Li ne () ; Sy st e m. o ut . pr i n t l n ( " En t e r t h e pa t h of t he IV f i l e i ni t ve c f i l e = b r. re a d Li n e () ; Ge t Byt e s i ni t vec ; i ni t ve c = ne w Ge t Byt e s (i ni t ve c fi l e , 1 6) ; i v = i ni t ve c . ge t By t e s () ; En g2 He x e n g = ne w En g2 He x ( ); i f (f l a g= = 1 ) { e n g. c o n ve rt ( fi l e ) ; } : ") ;

145

A. E. S. Pu t By t e s p u t f i l e ; Ge t Byt e s ge t Inp ut ; i f (f l a g= = 1 ) { put fi l e = ne w P ut By t e s (o ut fi l e ); ge t In p ut = ne w Ge t By t e s( " i n t e r i m. t xt ", 1 6 ); } e l se { put fi l e = ne w P ut By t e s ( "i n t e ri m. t x t ") ; ge t Inp ut = ne w Ge t By t e s (f i l e , 1 6 ); } st a r t = Sy st e m. c u rr e nt Ti me Mi l l i s ( ); Ge t Byt e s ge t Ke y = n e w Ge t Byt e s ( ke y fi l e , nu mb i t s* 4 ); b yt e [ ] ke y = ge t Ke y. ge t Byt e s ( ); AE Se n c r yp t a e s = n e w AESe n c r yp t ( ke y, n u mbi t s ) ; b yt e [ ] o u t = n e w by t e [ 16 ]; Pr i n t . p ri n t Ar r a y ( " Ke y: wh i l e ( g e t In pu t . f l a g!= 1 ) { ", k e y) ;

146

A. E. S. i n = ge t Inp ut . ge t By t e s () ; i f ( ge t Inp u t . fl a g != 1 ) { Sy st e m. o ut . pr i n t ( " " ); i f (f l a g= = 1 ) { Pr i n t . p ri n t Ar r a y ( " Pl a i n t e xt : ", i n) ;

fo r( nu mb i t s = 0; nu mbi t s <1 6; nu mb i t s + + ) { i n [nu mb i t s ] = ( by t e ) ( i n [nu mb i t s ] ^ i v[ n u mb i t s ]) ; } a e s. Ci ph e r (i n, ou t ) ; Pr i n t . p ri n t Ar r a y ( " Ci phe r t e x t : ", out );

Sy st e m. a r ra y c opy ( ou t , 0 , i v, 0, ou t . l e n gt h) ; } e l se { Pr i n t . p ri n t Ar r a y ( " Ci phe r t e x t : a e s. In vCi phe r( i n, out ) ; 147 ", i n) ;

A. E. S. fo r( nu mb i t s = 0; nu mbi t s <1 6; nu mb i t s + + ) { o ut [n u mbi t s] = (b yt e ) (o u t [ nu mb i t s ] ^ i v[ nu mb i t s ] ); } Sy st e m. a r ra yc opy ( i n, 0, i v,0, i n. l e n gt h ); Pr i n t . p ri n t Ar r a y ( " Pl a i n Te x t : } pu t fi l e . p u t (o ut ); } } e n d = Sy st e m. c u r re n t Ti me Mi l l i s( ); i f (f l a g!= 1 ) { e n g. t o En g(o ut fi l e ); } Sy st e m. o u t . p r i n t l n ( " Ex c ut i o n t i me i s st a r t ) ); } } :"+ (e n d ", out );

148

A. E. S.
A E S te s t

/ / Se q ue n t i a l i mpl e me nt a t i on i n EC B mod e / / 1 28- b i t 1 6, 16 , a n d 4 / / 1 92- b i t 1 6, 24 a n d 6 / / 2 56- b i t 1 6, 32 a n d 8 i mp o rt j a va . i o. *; / ** Ap pl i c a t i on i mpl e me nt i n g t h e AES a l go r i t h m a s de f i ne d i n F IP S- 1 9 7 */ pub l i c c l a s s AESt e st { pub l i c s t a t i c vo i d ma i n ( St r in g[ ] a r g s ) t h r o ws IOExc e pt i o n { St ri n g fi l e , ke y f i l e , e n c de c , o u t fi l e ; i nt fl a g= 1, n u mb i t s =1 ; b yt e [ ] i n ; Buf fe re d Re a de r br = ne w Buf fe re d Re a d e r (ne w

Inp ut St re a mRe a de r( Sy s t e m. i n ) ); l on g s t a rt , e n d; whi l e ( fl a g> 0 ) { Sy st e m. o ut . pr i n t l n ( " 1. Enc r y p t i o n " ); 149

A. E. S. Sy st e m. o ut . pr i n t l n ( " 2. De c ryp t i on " ); e nc de c = b r. re a d Li n e ( ); Sy st e m. o ut . pr i n t l n ( " " ); fl a g = Int e ge r. pa r se In t (e nc de c ); i f (f l a g= = 1 | | fl a g= = 2 ) b re a k; e l se { Sy s t e m. ou t . p ri n t l n ( " Er ro n o usIn pu t . . . t r y fl a g= 1; } } wh i l e ( n u mb i t s > 0) { Sy s t e m. ou t . p ri n t l n( " 1. 128-b i t " ); Sy s t e m. ou t . p ri n t l n( " 2. 192-b i t " ); Sy st e m. o ut . pr i n t l n ( " 3. 256- bi t " ) ; e nc de c = b r. re a d Li n e ( ); nu mbi t s = In t e g e r. pa r s e In t (e nc de c ); i f (n u mbi t s = = 1 ) a ga i n. . " ) ;

150

A. E. S. { nu mb i t s =4 ; bre a k; } e l se i f( nu mb i t s = = 2) { numb i t s = 6 ; bre a k; } e l se i f (nu mb i t s = = 3 ) { nu mb i t s = 8; bre a k; } e l se { Sy s t e m. ou t . p ri n t l n ( " Er ro n e ou s Inp ut . . . . t r y a ga i n " ); Sys t e m. ou t . p ri nt l n ( " " ); nu mb i t s = 1; }

151

A. E. S. } Sy st e m. o u t . p r i n t l n ( " En t e r f ul l pa t h of t he fi l e : " ); fi l e = b r. re a d Li ne ( ); Sy st e m. o u t . p r i n t l n ( " " ); Sy st e m. o u t . p r i n t l n ( " " ); Sy st e m. o u t . p r i n t l n ( " En t e r f ul l pa t h of ke y fi l e ") ; k e y fi l e = b r. re a d Li n e ( ); Sy st e m. o u t . pr i n t l n ( " " ); Sy st e m. o u t . p r i n t l n ( " " ); Sy st e m. o u t . p r i n t l n ( " En t e r pa t h o f out pu t f i l e : " ) ; o ut fi l e = b r. r e a d Li ne () ; En g2 He x e n g = ne w En g2 He x ( ); i f (f l a g= = 1 ) { e n g. c o n ve rt ( fi l e ) ; } Pu t By t e s p u t f i l e ; Ge t Byt e s ge t Inp ut ; i f (f l a g= = 1 ) {

152

A. E. S. put fi l e = ne w P ut By t e s (o ut fi l e ); ge t In p ut = ne w Ge t By t e s( " i n t e r i m. t xt ", 1 6 ); } e l se { put fi l e = ne w P ut By t e s ( "i n t e ri m. t x t ") ; ge t Inp ut = ne w Ge t By t e s (f i l e , 1 6 ); } st a r t = Sy st e m. c u rr e nt Ti me Mi l l i s ( ); Ge t Byt e s ge t Ke y = n e w Ge t Byt e s ( ke y fi l e , nu mb i t s* 4 ); b yt e [ ] ke y = ge t Ke y. ge t By t e s ( ); AE Se n c r yp t a e s = n e w AESe n c r yp t ( ke y, n u mbi t s ) ; b yt e [ ] o u t = n e w by t e [ 16 ]; / / Pr i n t . pr i nt Ar r a y ( " Ke y : wh i l e ( g e t In pu t . f l a g!= 1 ) { i n = ge t Inp ut . ge t By t e s () ; i f ( ge t Inp u t . fl a g != 1 ) { Sy st e m. o ut . pr i n t ( " " ); ", ke y );

153

A. E. S. i f (f l a g= = 1 ) { Pr i n t . p ri n t Ar r a y ( " Pl a i n t e xt : ", i n );

a e s. Ci ph e r (i n, ou t ) ; Pr i n t . p ri n t Ar r a y ( " Ci phe r t e x t : } e l se { Pr i n t . p ri n t Ar r a y ( " Ci phe r t e x t : a e s. I n vCi p he r( i n , out ) ; Pr i n t . p ri n t Ar r a y ( " Pl a i n Te x t : } pu t fi l e . p u t (o ut ); } } e n d = Sy st e m. c u r re n t Ti me Mi l l i s( ); i f (f l a g!= 1 ) { e n g. t o En g(o ut fi l e ); } 154 ", out ); ", i n) ; ", out );

Sy st e m. o ut . pr i n t l n ( " Ex e c u t i o n t i me i s } }

A. E. S. : " + (e nd - st a rt ) );

Copy

** Cl a s s h a s st a t i c fu nc t i o n s t h a y ma p 1 - D a rra y s t o a 2 - D a rr a y s a n d vi c e ve r sa */ pub l i c c l a s s Co py { pr i va t e s t a t i c fi n a l i n t Nb = 4 ; pub l i c s t a t i c vo i d c o py (b yt e [ ][ ] st a t e , by t e [ ] i n ) { i nt i n Lo c = 0; fo r ( i n t c = 0; c < Nb; c + + ) { fo r ( i n t r = 0 ; r < 4 ; r + + ) { st a t e [r ] [c ] = i n [i n Lo c + + ] ; } 155

A. E. S. } } pub l i c s t a t i c vo i d c o py (b yt e [ ] ou t , byt e [ ][ ] st a t e ) { i nt out Lo c = 0 ; fo r ( i n t c = 0; c < Nb; c + + ) { fo r ( i n t r = 0 ; r < 4 ; r + + ) { ou t [o ut Lo c + + ] = s t a t e [ r ][c ]; } } } pub l i c s t a t i c voi d c o p y( by t e [ ] o ut , b yt e [ ][ ] st a t e, i n t t h re a d ) { i nt out Lo c = t hre a d* 1 6 ; o ut Lo c =o ut Lo c- 16 ; fo r ( i n t c = 0; c < Nb; c + + ) { fo r ( i n t r = 0 ; r < 4 ; r + + ) 156

A. E. S. { ou t [o ut Lo c + + ] = s t a t e [ r ][c ]; } } } }

Print

/ ** Ha s s t a t i c fu n c t i o n s t o p e r fo r m p r i n t i n g o p e ra t i on s o n o ne a nd t wo d i me n si o na l by t e a rra y s. * / pub l i c c l a s s P ri nt { pr i va t e s t a t i c fi n a l i n t Nb = 4 ; pr i va t e s t a t i c St ri n g[] di g = { " 0 ", "1 ", "2 ", " 3 ", "4 ", "5 ", " 6 ", "7 ", " 8", " 9 ", "a ", "b ", "c ", " d ", "e ", "f " }; pub l i c s t a t i c St r i n g he x (b yt e a ) { re t u r n d i g [ (a & 0x f f) > > 4] + d i g [ a & 0 x 0f ]; } 157

A. E. S. / / > > u s e d f o r l e ft sh i f t , & u se d f or b i t wi se AND pub l i c s t a t i c vo i d p r i nt Ar ra y( St r i n g na me , b yt e [ ] a ) { Sy st e m. o u t . p r i n t ( na me + " " ); fo r ( i n t i = 0 ; i < a . l e n gt h; i + + ) Sy st e m. o ut . pr i n t ( he x (a [i ]) + " " ); Sy st e m. o u t . p r i n t l n ( ); } pub l i c st a t i c vo i d p ri n t Ar r a y ( St r i n g n a me , b yt e [ ] a , i n t t h re a d ) { Sy st e m. o u t . p r i n t ( na me + " " ); i nt i =t hre a d* 1 6 ; fo r ( i = i -16 ; i < t h re a d *16 ; i + + ) Sy st e m. o ut . pr i n t ( he x (a [i ]) + " " ); Sy st e m. o u t . p r i n t l n ( ); } pub l i c s t a t i c vo i d p r i nt Ar ra y( St r i n g na me , b yt e [ ] [] s ) { Sy st e m. o u t . p r i n t ( na me + " " ); fo r ( i n t c = 0; c < Nb; c + + ) 158

A. E. S. { fo r ( i n t r = 0 ; r < 4 ; r + + ) { Sy st e m. o ut . pr i n t ( he x ( s [r ] [c ] ) + " " ); } } Sy st e m. o u t . pr i n t l n ( ); } }

159

A. E. S.

TEST CA SES
S No. 1 In p ut 1. Enc r yp t i o n 2. De c ryp t i on Ac t u a l Out p ut 1. 128 2. 192 3. 256 1 2 1. Enc r yp t i o n 2. De c ryp t i on 1. 128 2. 192 3. 256 2 3 1. Enc r yp t i o n 2. De c ryp t i on Err on e ou s Inp ut . . . t ry a ga i n. . Err on o u s No Inp ut . . . t ry Err or a ga i n. . 1. 128 2. 192 3. 256 No Err or Ex pe c t e d Out pu t 1. 128 2. 192 3. 256 Err or No Err or

3 4 1. Enc r yp t i o n 2. De c ryp t i on Pr o g ra m Ha l t s Err or Err on o u s Inp ut . . . t ry a ga i n. .

34 5 34 5 34 54 5 5 1. Enc r yp t i o n 2. De c ryp t i on Pr o g ra m Ha l t s Err or Err on o u s Inp ut . . . t ry a ga i n. .

1w

160

1. Enc r yp t i o n 2. De c ryp t i on

Pr o g ra m Ha l t s

Err on o u s Inp ut . . . t ry a ga i n. .

A. E. S. Err or

! 7 1. Enc r yp t i o n 2. De c ryp t i on Pr o g ra m Ha l t s Err or Err on o u s Inp ut . . . t ry a ga i n. .

1. Enc r yp t i o n 2. De c ryp t i on

Ex e c ut e s e nc ry pt i on fo r ke y s i z e 1 2 8

Ex e c ut e s fo r ke y si z e 12 8

No Err or

1. 1 28 2. 1 92 3. 2 56

1 9 1. Enc r yp t i o n 2. De c ryp t i on Ex e c ut e s e nc ry pt i on fo r ke y s i z e 1 9 2 No Err or

1. 1 28 161

A. E. S. 2. 1 92 3. 2 56

2 10 1. Enc r yp t i o n 2. De c ryp t i on Ex e c ut e s e nc ry pt i on fo r ke y s i z e 2 5 6 Ex e c ut e s fo r ke y si z e 25 6 No Err or

1. 1 28 2. 1 92 3. 2 56

3 11 1. Enc r yp t i o n 2. De c ryp t i on Ex e c ut e s de c ry pt i on fo r ke y s i z e 1 2 8 Ex e c ut e s fo r ke y si z e 12 8 No Err or

1. 1 28 2. 1 92 3. 2 56

1 162

A. E. S. 12 1. Enc r yp t i o n 2. De c ryp t i on Ex e c ut e s de c ry pt i on fo r ke y s i z e 1 9 2 Ex e c ut e s de c r yp t i o n fo r ke y si z e 19 2 No Err or

1. 1 28 2. 1 92 3. 2 56

13

1. Enc r yp t i o n 2. De c ryp t i on

Ex e c ut e s de c ry pt i on fo r ke y s i z e 2 5 6

Ex e c ut e s de c r yp t i o n fo r ke y si z e 25 6

No Err or

1. 1 28 2. 1 92 3. 2 56

3 14 1. Enc r yp t i o n 2. De c ryp t i on Err on e ou s Inp ut . . . t ry a ga i n. . Err on e ou s Err or Inp ut . . . t ry a ga i n. . 163

A. E. S. 2

1. 1 28 2. 1 92 3. 2 56

5 15 1. Enc r yp t i o n 2. De c ryp t i on Pr o g ra m Ha l t s Err on e ou s Err o r Inp ut . . . t ry a ga i n. .

1. 1 28 2. 1 92 3. 2 56

aes 16 Ke y = 2b 7e 15 162 8a e d2 a 6a b f7 15 88 0 9c f 4 f3c Ci ph e r Te x t = ( Bl a n k) De c r y p t e d Te x t = ( Bl a n k) No Err or

De c r y p t e d Te x t = ( Bl a n k) Pl a i n Te x t = ( Bl a n k )

164

17

Ke y = 00 0 10 2 03 04 0 50 6 07 0 80 90a 0b 0c 0d 0e 0 f1 01 1 12 1 31 41 5 16 1 7

Ci ph e r Te x t = 762 541 b9e e 51 6 f d6 44 a 13c 2d2 2e a 6 2 0a d4 e f 625 083 5a 8 2dc e 7 0 43 1 1f5 5b 77 4 dc

De c r y p t e d Te x t = h e l l o . . !! h o w a re y ou doi n g ?

A. E. S. No Err or

Pl a i n Te x t = h e l l o . . !! ho w a re y ou do i n g ?

De c r y p t e d Te x t = h e l l o . . !! h o w a re you d oi n g ?

18

Ke y = 00 0 10 2 03 04 0 50 6 07 0 80 90a 0b 0c 0d 0e 0 f1 01 1 12 1 31 41 5 16 1 7

Pl a i n Te x t = The Ad v a nc e d Enc r ypt i o n St a n da rd ( AE S) spe c i fi e s a F IP Sa pp ro ve d c ry pt o gr a p hi c a l go r i t h m t ha t c a n be use d t o pro t e c t

Ci ph e r Te x t = 9e a 1 76a a 7 bc 8e 1 044 4 05e f9d 9c 2 9 7 10 a e a 41 b3f da 5 28e e 3 a fe 5 40 7 9b5 219 6c 8 a fc 41 8f 5f 39a a e 45b 2 fd 9 62 e 46 1 a dde 69e 8 d6c 3 8 13 c 1c f22 60 2e 0 f7 1b 64 fe f 76 b1e 1 c 99 69 8 16 5 b 04 7 5c 0 f8 f8c 7b 4 54 05e f9 c 3e c 8 dd7 e 74 5 7 2f 02 4 043 27a 542 56 7 f 9f e 5b 045a 72 3a 2a 1 8 6c 4 b 91 d7c 1 68a 19 b dd 1 9 94 7 781 bd6 73 df 6 c d 6c 1 43 e 72 fc 1e 2 6 d4 b a 7d 6f d 3c 67 d1 64d a 8 fc 6 722 6 803 013 10 9b 9 d7 6 7 64 70da f f7 b0 7 1e 0 1e 3 0a a 8a a 4a 6e f4 2 c 67 b5a 6 12de 43 1f 0 f 91 e 42 3f fe 947 3e b 5a f 7 a 1 62 275 3 770 78b e b7 4b 7 23 d 3 3

Pl a i n Te x t Err or = The Ad va nc e d En c r ypt i o n St a nda rd ( AE S) spe c i fi e s a F IP Sa pp ro v e d c ry pt o gr a phi c a l go r i t h m t ha t c a n be u se d t o pro t e c t e l e c t ro ni c da t a . Th e AE S a l go r i t h m is a sy m me t ri c bl o c k 165

A. E. S. e l e c t ro ni c da t a . The AE S a l go r i t h m i s a 547a 6e 2 da 8 1 de 73 a 56 0f6 28 76 5 40 0 f c 94 3d b 914 833 c 6 f4 89 fe 4a ba 02e b 95 b83 d fa 9 3 12 89 694e a 98 6b b e 9 93 b 06 3 e a a 4d bc 5 5 03 3 0e 56 b9 sy m me t ri c c a ba 6 4c 8 3 90 5 7 6b b 83 bl oc k c i p he r 691 488 45 50 6 3a ff f0 b t ha t c a n a a a 94 216 8b 0 0 94 a e 0d e nc r yp t d14 5a a 5 50 0 4 f8 c 7a e e (e n c i p he r ) 162 da 8 93c 5 5e 5c 3 2 2b a nd de c r ypt 2e 29 05 7f 3 a 5 71 c 747 1 (d e c i p he r ) bc 23 90 6d3 c 20 b 4 64 c f i n fo r ma t i on. 019 bf 87 0 25 2 d 0d f3 14 285 132 c 58 41 6 04 e d c f Enc r ypt i o n c on ve r t s da t a a e c 67 002 b1 8 d 4a f 6e c 5de 8 1f 63 0 b 5f 53a 89d to an un i n t e l l i g i bl e dba a e 43e 5 2c e c 12 436 bc 21 5b d91 d f0 5a 14 09 fo r m c a l l e d 010 b8a 9a f e f 363 6e 7 7 c i ph e r t e x t ; f1b 8a d c c e b 60 22d f fd de c r yp t i n g 900 8e 1 d2d 7c 8 6 8e 32 6 t he 19e b 34e 7f d 6 06 1 e f 78 c i ph e r t e x t 4f5 87 dbe a c c 7 9b f6c 7 c on ve r t s t h e 7fc 472 6d b 6a 97 4 11 97 da t a b a c k f33 05 32 1 f de 6 6e 8c 55 i nt o i t s 667 bc b f3a fe df f5 86 3 3 or i gi n a l 0a d ff 9 1e 66 3 e 70 c a 9a fo r m, c a l l e d 750 5d2 19 d7c c 9 3 58 8 pl a i nt e xt . 607 24 f3 6 49 8 8 30 1 b6 6 3c 72 c 72 56 0 11 3 c 6 9c 9 The AES c 5f d96 8d b a e c 4b3 24 b a l go r i t h m i s 8a 27 a e e 0 7 14 3 9 6b d b2 c a pa b l e o f b41 f2 38 f4e 38 1c 3 942 us i n g c ry pt o gr a p hi 901 260 d9 6a 9 b be dfe c c e 60 6a 48 2c c 31 6 69 a f c ke y s o f 12 8, 1 9 2, a n d b62 15 f7 8 3e 8b 3c 30 29 c i ph e r t ha t c a n e nc r yp t (e nc i p he r ) a nd de c r yp t (de c i p he r ) i n fo r ma t i on.

En c r ypt i o n c on ve r t s da t a t o a n uni nt e l l i g i bl e fo r m called c i ph e r t e x t ; de c r yp t i n g the c i ph e r t e x t c on ve r t s t he d a t a ba c k i nt o s o ri gi na l fo r m, called pl a i nt e xt .

Th e AES a l go r i t h m i s c a pa b l e of u s i n g c ry pt o gr a phi c ke y s 166

A. E. S. 25 6 b i t s t o e nc r yp t 438 07a b18 2 f3 fc e f06 25e 0 b4 762 1 of 1 28, 192, a n d 256 b i t s t o e n c ry pt a nd de c r yp t da t a i n bl o c ks o f 128 b i t s.

a nd de c r ypt da t a i n De c r y p t e d Te x t = bl oc k s o f 12 8 Th e Ad va nc e d bi t s. En c r ypt i o n St a n da r d ( AE S) sp e c i fi e s a F IP S- a pp ro ve d c ry pt o gr a p hi c a l go r i t h m t ha t c a n be use d t o p rot e c t e l ec t ro ni c da t a . Th e AE S a l go ri t h m i s a sy m me t ri c b l o c k c i ph e r t ha t c a n e nc r yp t (e n c i p he r ) a nd de c r y pt (de c i p he r ) i n fo r ma t i on. Enc ry p t i on c o n ve rt s d a t a t o a n un i n t e l l i gi b l e fo r m c a l l e d c i ph e r t e x t ; de c r yp t i n g t he c i ph e r t e x t c on ve rt s t he d a t a b a c k i nt o s or i gi na l fo r m, c a l l e d pl a i nt e xt . Th e AE S a l go ri t h m i s c a pa b l e o f u si n g c ry pt o gr a p hi c ke y s of 1 28, 1 92, a n d 25 6 bi t s t o e nc r ypt a nd de c r yp t da t a i n bl o c ks o f 12 8 bi t s.

167

19

Ke y = 00 0 10 2 03 04 0 50 6 07 0 80 90a 0b 0c 0d 0e 0f1 01 1 12 1 31 41 5 16 1 7

Ci ph e r Te x t = ( Bl a n k)

De c r y p t e d Te x t = ( Bl a n k)

A. E. S. No Err or

De c r y p t e d Te x t = ( Bl a n k)

Pl a i n Te x t = ( Bl a n k ) 20 Ke y = * &% &^ $% & ^$ ^% # %^ $* ^ !^ * &!^ & !) &* ) !@( &) *( !* ^ @* &^ @* ^( Ci ph e r Te x t = Ex c e pt i o n 9a 62 3a a 7 65 5 9 3d 6 90 7 = Wr o n g 2f7 9 f0b c a f 3be 1 fo r m o f ke y De c r yp t e d Te x t = Hi i i Err or

Pl a i n Te x t = Hi i i 21 Ke y = 00 0 10 2 03 04 0 50 6 07 0 80 90a 0b 0c 0d 0e 0 f1 01 1 12 1 31 41 5 16 1 7 Ci ph e r Te x t = De c r y p t e d 9a 62 3a a 7 65 5 9 3d 6 90 7 Te x t = !! ! 2f7 9 f0b c a f 3be 1 !! ! !!

De c r y p t e d Te x t = !! ! ! !! ! !

Pl a i n Te x t = !!! !! ! ! ! 22 Ke y = 00 0 10 2 03 04 0 Ci ph e r Te x t = d79 739 e 18 f dc 3 4 3b 51 Pl a i n Te x t = q Err or

168

A. E. S. 50 6 07 0 80 90a 0b 0c 0d 0e 0 f1 01 1 12 1 31 41 5 16 1 7 3c 16 c a 05 0ba d 1 8

De c r y p t e d Te x t =

Pl a i n Te x t = q 23 Ke y = 00 0 10 2 03 04 0 50 6 07 0 80 90a 0b 0c 0d 0e 0 f1 01 1 12 1 31 41 5 16 1 7 Ci ph e r Te x t = e 279 c e 45 4a b b 8 4c b 9e 1c b0 54 331 d f6 9 72 df 9 92e 7 57 102 5c c 74 1 f6 1 c 809 80c 92 7 2d f9 92 e 7 571 025 c c 7 4 1 f6 1 c 80 9 80c 9 27 867 8 f5 3 fe c 76 4b2 481 0 fc 2 d0 fc b 653 eb Pl a i n Te x t = a y No Err or

Pl a i n Te x t = a y

De c r y p t e d Te x t = a y Pl a i n Te x t No = 1 Err or

24

Ke y = 00 0 10 2 03 04 0 50 6 07 0 80 90a 0b 0c 0d 0e 0 f1 01 1 12 1 31 41 5 16 1 7 Ci ph e r Te x t = c dd 9 d0 44d 0a 7 34 1f 6 a a c e f0 6e b 4 e 1 e a 3

De c r y p t e d Te x t = 1 Pl a i n Te x t = 1

25

Ke y = 00 0 10 2 03 04 0

Ci ph e r Te x t = da 98 32 b74 6 f9 0 5c 2 c 5

Pl a i n Te x t = 12

No Err or 169

A. E. S. 50 6 07 0 80 90a 0b 0c 0d 0e 0 f1 01 1 12 1 31 41 5 16 1 7 0e 6a 967 60a 4 c f2 345 678 9 0

De c r y p t e d Te x t = 123 45 6 78 9 0

Pl a i n Te x t = 123 45 67 8 90 26 Ke y = 00 0 10 2 03 04 0 50 6 07 0 80 90a 0b 0c 0d 0e 0 f1 01 1 12 1 31 41 5 16 1 7 Ci ph e r Te x t = f40 7e 2 bba 6 6a f0 9b f7 d36 210 a 49 46 2 7b Pl a i n Te x t = &^ % &^ % &^ % &% No Err or

De c r y p t e d Te x t = &^ % &^ % &^ % &%

Pl a i n Te x t = &^ % & ^% &^ % &%

27

Ke y = 00 0 10 2 03 04 0 50 6 07 0 80 90a 0b 0c 0d 0e 0 f1 01 1 12 1 31 41 5 16 1 7

Ci ph e r Te x t = a e 93 929 9c 9 4 7 80 6 fe 2 134 b5a a c 6b 0 0 b8

Pl a i n Te x t = ~

No Err or

De c r y p t e d Te x t = ~

Pl a i n Te x t = ~ 170

28

Ke y = 00 0 10 2 03 04 0 50 6 07 0 80 90a 0b 0c 0d 0e 0 f1 01 1 12 1 31 41 5 16 1 7

Ci ph e r Te x t = 2df 99 2e 7 5 7 10 2 5c c 7 4 1f 6 1c 8 09 80c 927

Pl a i n Te x t =

A. E. S. No Err or

De c r y p t e d Te x t =

Pl a i n Te x t = 29 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n t e xt = 8 000 00 0 00 0 0 0 000 000 00 00 0 00 0 0 00 000 (i n he x ) Pl a i n t e xt = 8 00 000 000 00 000 000 00 000 000 00 000 00 (i n he x ) No Err or

= ? Ci p h e r (i n e n g) Te x t = 3 AD7 8E72 6 C1 EC0 2 B7 EBF E92 B 23 D9EC34 30 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00

Pl a i n Te x t = 4 00 00 000 00 0 00 0 0 0 000 000 00 00 0 00 0 0 0 (i n he x ) = @ (i n e n g)

Ci p h e r Te x t = 45 BC707 D2 9 E8 2 0 4 D8 8 DF B A2 F0 B0 CA D9 B

Pl a i n Te x t No Err or = 4 00 00 00 000 000 00 000 000 00 000 000 00 0

171

31

Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00

Pl a i n Te x t = 2 00 00 000 00 0 00 0 0 0 000 000 00 00 0 00 0 0 0 (i n he x ) = ( i n e n g)

Ci p h e r Te x t = 161 55 683 80 18 F5 2 80 5 CD BD62 02 002 E 3F 32 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n Te x t = 100 00 0 00 0 0 00 000 000 00 00 0 00 0 0 00 000 (i n He x ) = ( i n e n g ) Ci p h e r Te x t = F5 56 9 B3 AB6 A6 D1 1 EF DE 1 BF 0 A6 4 C6 8 54 A 33 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n Te x t = 080 00 0 00 0 0 00 000 000 00 00 0 00 0 0 00 000 (i n He x ) = ( i n e n g ) Ci p h e r t e x t = 64 E8 2 B50 E5 01 F BD7 DD4 11 6 92 1 15 9 B8 3E

A. E. S. Pl a i n Te x t No Err or = 2 00 00 00 000 000 00 000 000 00 000 000 00 0 ( i n he x )

Pl a i n Te x t = 10 000 000 00 000 000 00 000 000 00 000 000 (i n He x )

No Err or

Pl a i n Te x t = 08 000 000 00 000 000 00 000 000 00 000 000 (i n He x )

No Err or

172

34

Ke y = 00 0 00 0 00 00 0 00 0 00 000 00 0 00 0 00 0 00 00

Pl a i n Te x t = 040 000 00 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) =

Ci p h e r t e x t = B AAC1 2 F B6 13 A7 DE1 1 45 03 7 5 C7 403 40 41 35 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00

Pl a i n Te x t = 040 000 00 000 000 00 000 000 00 000 000 00 (i n He x )

A. E. S. No Err or

Pl a i n Te x t = 020 000 00 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) (i n e n g)

Ci p h e r t e x t = BCF1 76 A7 E AAD8 08 5 EB ACE A3 62 4 62 A2 8 1 36 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n Te x t = 010 00 0 00 0 0 00 000 000 00 00 0 00 0 0 00 000 (i n He x ) = eng) Ci p h e r Te x t = 47 7 11 8 16 E91 D6F F 059 BB BF2 BF5 8 E0 F D3 (i n

Pl a i n No Err or Te x t = 020 000 00 000 000 00 000 000 00 000 000 00 (i n He x )

Pl a i n Te x t = 01 000 000 00 000 000 00 000 000 00 000 000 (i n He x )

No Err or

173

37

Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00

Pl a i n Tex t = 008 00 000 00 0 00 0 0 0 000 000 00 00 0 00 0 0 0 (i n He x ) = ? eng) ( i n

Ci p h e r Te x t = B97 0 DF BE4 06 9 8 AF 1 638 F E38 BD3 DF 3 B2 F 38 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n Te x t = 004 000 00 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) = @ eng) Ci p h e r Te x t = F9 5 B5 9 A4 4 F3 91 E1 4 CF 2 0 B74 BDC3 2 F CF F 39 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00

Pl a i n Te x t = 008 00 00 000 000 00 000 000 00 000 000 00 0 ( i n He x )

A. E. S. No Err or

Pl a i n No Err or Te x t = 004 000 00 000 000 00 000 000 00 (i n 000 000 00 (i n He x )

Pl a i n Te x t = 002 000 00 00 0 00 0 000 000 000 00 00 0 00 0 0 (i n He x ) = eng) (in

Ci p h e r Te x t = 72 0 F7 4 AE0 4 A2 A4 35 B9 A 72 5 6 E4 9 37 8F 5 B

Pl a i n No Err or Te x t = 002 000 00 000 000 00 000 000 00 000 000 00 (i n He x )

174

40

Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00

Pl a i n Te x t = 001 000 00 00 0 00 0 0 00 000 000 00 00 000 00 (i n He x ) = (i n e n g )

Ci p h e r Te x t = 2 A0 445 F 61 D 36 BF A7 E2 7 7 07 0 73 0 CF 76 DA 41 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n Te x t = 000 800 00 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) = ( i n e n g) Ci p h e r Te x t = 8 D0 536 B99 7 AEF EC1 D9 4 01 1 B AB6 6 9 9 A0 3 42 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n Te x t = 000 400 00 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) = Ci p h e r Te x t = (i n e n g) 67 4 F0 02 E19 F6 ED47 EFF 3 19 E5 1F AD4 4

Pl a i n Te x t = 001 000 00 000 000 00 000 000 00 000 000 00 (i n He x )

A. E. S. No Err or

Pl a i n No Te x t = Err or 000 800 00 000 000 00 000 000 00 000 000 00 (i n He x )

Pl a i n No Te x t = Err or 000 400 00 000 000 00 000 000 00 000 000 00 (i n He x )

175

A. E. S. 98 43 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n Te x t = 000 200 00 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) = (i n e n g ) Ci p h e r Te x t = 29 2 C02 C5 C B916 3 C8 0 AC 0F 6 CF 1 DD8 E9 2 D 44 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n Te x t = 000 100 00 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) = (i n e n g) Ci p h e r Te x t = F A3 21 CF 18 E F5 F E72 7 DD8 2 A5 C1 E94 51 41 45 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n Te x t = 000 080 00 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) = ? eng) Ci p h e r Te x t = A5 A7 AF E1 0 34 C3 9 CCCE (in Pl a i n No Err or Te x t = 000 200 00 000 000 00 000 000 00 000 000 00 (i n He x )

Pl a i n No Err or Te x t = 000 100 00 000 000 00 000 000 0 0 000 000 00 (i n He x )

Pl a i n No Err or Te x t = 000 080 00 000 000 00 000 000 00 000 000 00 (i n He x )

176

A. E. S. BE3 C58 4 BC0 BE0 5 46 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n Te x t = 000 040 00 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) = @ eng) Ci p h e r Te x t = 4F F5 A52 E69 7E77 D08 12 0 5 DBDB2 1 CE A3 9 47 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n No Err or Te x t = 000 040 00 000 000 00 000 000 00 (i n 000 000 0 0 (i n He x )

Pl a i n Te x t = 000 020 00 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) = eng) (i n

Ci p h e r Te x t = 20 9 E88 DC9 4 C900 30 00 CE 07 6 9 AF 7 B71 66 48 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n Te x t = 000 010 00 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) = (in eng) Ci p h e r Te x t =

Pl a i n No Err or Te x t = 000 020 00 000 000 00 000 000 00 000 0000 0 (i n He x )

Pl a i n No Err or Te x t = 000 010 00 000 000 00 000 000 00 000 000 00 (i n He x )

177

A. E. S. 5 DEE41 AF 86 4 CB4 B6 5 0E5 F5 15 5 18 24 D 38 49 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n Te x t = 000 008 00 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) = Ci p h e r Te x t = A7 9 A63 F A7 E4 5 0 3 AE6 D6 E0 9 F 5 F 9 0 53 03 0 50 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n Te x t = 000 004 00 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) = Ci p h e r Te x t = (i n e n g) A4 8 316 74 9F AE7 F AC7 00 2 03 1 A6 AF D8 B A7 51 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n Te x t = 000 002 00 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) = (in eng) ( i n e n g) Pl a i n No Err or Te x t = 000 008 00 000 000 00 000 000 00 000 000 00 (i n He x )

Pl a i n No Err or Te x t = 000 004 00 000 000 00 000 000 00 000 000 00 (i n He x )

Pl a i n Te x t = 000 002 00 000 000 00 000 000 00 000 000 00

No Err or

178

A. E. S. Ci p h e r Te x t = D6 EEE8 A7 3 5 7 A0 E1 D6 426 2 CA9 C33 7 A C42 52 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n Te x t = 000 001 00 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) = eng) Ci p h e r Te x t = B013 C A8 A6 2 A8 5 805 3 E9 F B667 ED39 8 2 9E 53 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n Te x t = 000 000 80 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) = ? eng) Ci p h e r Te x t = DF6 E A9 E4 53 8 A4 5 A5 2 D5 C1 A4 3 C8 8 F 4 B55 54 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 Pl a i n Te x t = 000 000 40 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) (in (i n (i n He x )

Pl a i n No Err or Te x t = 000 001 00 000 000 00 000 000 00 000 000 00 (i n He x )

Pl a i n No Err or Te x t = 000 000 80 000 000 00 000 000 00 000 000 00 (i n He x )

Pl a i n Te x t = 000 000 40 000 000 00

No Err or

179

A. E. S. 00 0 00 0 00 00 = @ eng) (i n 000 000 00 000 000 00 (i n He x )

Ci p h e r Te x t = 7 D0 3 BA4 51 3 71 5 91 D3 F D5 54 7 D91 65 C7 3B 55 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n Te x t = 000 000 20 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) = eng) Ci p h e r Te x t = 0E04 262 81 A 62 7 7 E1 8 64 99 D36 5 D5 F4 9 F F 56 Ke y = 00 0 00 0 00 00 0 00 0 00 0 00 00 0 00 0 00 0 00 00 Pl a i n Te x t = 000 000 10 00 0 00 0 0 00 000 000 00 00 0 00 0 0 (i n He x ) = Ci p h e r Te x t = DBC02 16 9 D D20 59 E6 CC4 C57 C1F EDF 5 AB4 (in eng) (i n Pl a i n No Err or Te x t = 000 000 20 000 000 00 000 000 00 000 000 00 (i n He x )

Pl a i n No Err or Te x t = 000 000 10 000 000 00 000 000 00 000 000 00 (i n He x )

180

A. E. S.

REFR EN CES

1. A. Le e , NIST Sp e c i a l Pu bl i c a t i on 800- 2 1, No ve mbe r


19 9 9 Gui d e l i n e fo r Imp l e me n t i n g Cry pt o gra p hy i n t h e Fe de ra l Go ve rn me n t , Na t i o na l In s t i t u t e o f St a nda rd s a n d Te c hn o l o gy

2. Ca me ro n L. Poc e k

Pa t t e r s o n, a nd

Ap r M.

20 00. Hi gh Ar n ol d,

pe r fo r ma nc e e d i t o r s, IEE E

DESe n c r y p t i o n i n Vi r t e x F P G As u si n g J Bi t s. In Ke n ne t h Je f f re y Sy mp os i u m o n F i e l d- P ro gra m ma b l e Cu st o m Co mpu t i n g Ma c hi ne s ( F CCM 20 0 0) pa ge s 11 3 12 1 . 3. Ca me ro n C e t i n Ko c Embe d de d Pa t t e r s on of a nd Sy st e ms , Au g t he 2 00 0 . A dy na mi c FPGA In

i mp l e me n t a t i o n

Se rpe n t

b l oc k

c i phe r.

Ch ri s t o f ( CHES

P a a r, 20 00)

e d i t o rs, S e c on d p a ge s 1 411 55 .

In t e r na t i o na l Wo r ksh op on Cry pt o gra phi c Ha rd wa r e a n d Sp ri n ge r - Ve rl a g Le c t u r e No t e s i n Co mpu t e r Sc i e nc e , Vol u me 196 5 4. Fe de ra l c a nd i d a t e Re gi st e r 62, and a l go ri t h m Se p 1 997. Na t i ona l An nou nc i n g fo r In s t i t ut e re que s t of for

St a n da rd s

Te c h n ol o gy.

no mi n a t i o n s

t he

Ad va nc e d

Enc r ypt i o n St a n da r d ( AES) . ( 117 ) : 4 80 5 1 48 05 8

181

A. E. S. 5. Ja me s Ne c h va t a l , El a i ne Ba r ke r , La wre nc e Ba s s ha m, Wi l l i a m Bu r r, Mo r ri s Dwo r ki n, Ja me s Fo t i , a n d Ed wa r d Ro ba c k Oc t 2, 20 00. Re po rt o n t he de ve l op me n t of t h e Ad va nc e d En c ry pt i o n St a n d a rd1.( AES) . Ava i l a b l e a t ht t p : / / www. ni s t . go v/ a e s / ro u nd 2 / r 2re p o rt . pd f

6. J. Da e me n a n d V. Ri j me n Se pt e mb e r 3, 19 99, AE S Pr op o sa l : Ri j nda e l , AE S Al go ri t h m Sub mi s si on, , a va i l a b l e a t [1 ].

Bo o ks 1 ) Cry pt o g ra p h y a n d Ne t wo r k Se c u ri t y- Wi l l i a m St a l l i n g 2) Cr yp t o g ra ph y a nd Se c u ri t y - Fr oz u n WEBS ITES 1. ht t p: / / www. c s. u t sa . e d u/ ~ wa gne r / l a ws / AE SEnc ry pt . h t ml 2. ht t p: / / c s rc . n i st . go v/ a r c hi ve / a e s/ i n de x. h t ml 3. ht t p: / / www. h ooz i . c o m/ Ar t i c l e s/ AE S_ En c r y pt i o n . ht m 4. ht t p: / / www. h ooz i . c o m/ Ar t i c l e s/ AE S_ De c r yp t i on. h t m 5. ht t p: / / www. sn i a . o r g / ho me

182

A. E. S.

BIODA TA

183

Você também pode gostar