Int ern at i onal  Journ al of Ele ctrical  an d  Co mput er  En gin eeri ng   (IJ E C E)   Vo l.  9 , No . 6, Dece m ber  20 19, p p.   5615 ~ 5627   IS S N: 20 88 - 8708, DO I:   10 .11 591/ijece .v9i6 . pp5615 - 56 27          5615       Journ al h om e page http: // ia es core .c om/ journa ls /i ndex. ph p/IJECE   Cryptog ra ph ic a daptati on  of  th e mi dd le square gen erator       Ha n a Ali - P ac ha 1 ,   N aima  H ad j - S aid 2 Adda  Ali - P acha 3 ,   Moham ad A fe ndee  Moham e d 4 , Must afa  Mam at 5   1 ,2,3 La b.   of  Cod i ng  and  Se cur i t y   of  Inform at ion   ( LACOS I),   Univer sit y   of   Sci enc e s a nd  T ec hno log y   of  Oran ,   Alg er ia   4,5 Facul t y   of  Inf orm at ic s a nd   Co m puti ng,   Univer siti   Sult an Za in a Abidin ,   B esut Cam pus,  Malay s ia       Art ic le  In f o     ABSTR A CT    Art ic le  history:   Re cei ved   A pr   5 , 2 01 9   Re vised  Ju l   19 ,  201 9   Accepte J ul   28 , 2 01 9       Curre ntly ,   cr y p togra ph y   pl a y s   m aj or  rol e   in  var ious  co m pute and   te chno logi c al   ap pli c at ions.   W it the   high   num ber   of  i nt ern et  users ,   th use  of   cr y p togra ph y   t provide   info rm at ion  sec ur ity   h as  be come  prio rity .   Sever al   appl i ca t i ons  such  as  e - ma il s,  el e ct roni banki ng,   m edica dat ab ase s   and  e - c om m erce  req uir the   exc hang e   of  p riva t information.  W hil e ,   if  the   connect io is  not  sec ure ,   thi sensiti ve   i nform at ion  ca be  attac k ed .     The   best - known   cr y p togra ph ic   s y stems   rely   on   the   generation   of  ran dom  num ber s,  which  are   funda m ent a in  var ious  cr y p to gra phi appl i c at ions  such  as  ke y   gen era t i on  and  dat en cr y p ti on .   In  what  foll ows ,   we  want  to  use  pseudo - ran dom   seque nce gen er at ed  b y   the   m id dle   square   gen er at or.   In  thi work,  it   m ust  be  poss ibl to  es ti m at th at   th dat produc ed  h as  ran dom  cha ra cteri sti cs,   k nowing  tha th al gorit hm   used  i det erministi c .   Overa ll,  thi pape foc uses  on  the   te sting   of  ps eudo - ran dom   seque nce gene rated   b y   the m iddl e   square   g ene r at or   a nd  it s use   in   data   enc r y p ti on .   Ke yw or d s :   Crypto gr a phy     Entr op t est     Mi dd le   s qu a re  g ene r at or     Ra ndom   n ic kna m es     V on  n e um ann   Copyright   ©   201 9   Instit ut o f Ad vanc ed   Engi n ee r ing  and  S cienc e   Al l   rights re serv ed .   Corres pond in Aut h or :   Han a   Ali - Pach a ,   Lab. o C od i ng and Sec uri ty  of In form ation   ( LACO SI) ,   Un i ver sit y o f S ci ences a nd Te chnolo gy   of Or an ,   Po  B ox  1505  Or a M’ Na oue Al ger ia .   Em a il han a.ali pach a @ un i v - ust o.dz       1.   INTROD U CTION     The  de velo pme nt  of   al gorit hm s   gen erati ng  ps e udo - ra ndom   nu m ber is  ver m uch   relat ed  to  that  of  crypto gr a phy  [ 1 - 8].   Es pecial ly t he  m il i ta r ily   i m po rtance  s uch   as   c omm un ic at ion   a nd   m on it or ing   [9 - 10 ]   of  this  sci ence   ha v e   m otivate m any  researc he thr ough out  histor y.   But  t he re  is  no  ps e udo - ra ndom   al gorithm   that  can  esca pe   from   sta ti s tical   analy sis,  especial ly   beca us the   "seed"   m us theor et ic al ly   it sel be  rand om an the  al gorithm   us ed  canno be  init ia li zed   by  it sel f.   The  current  cry ptogra phic   gen e ra tors  are  th us   obli ge to  include  el e m ent  that  is   no gen e rated  in   deter m inist i way.  On th us   m ov es  towa rd hybr i ge ne rators,  fou nd i ng   r obus al gorithm   of  pse ud or a nd om   nu m ber   gen e rati on  by  init ia li zi ng   it sel thr ough  a   physi cal   m eans of  c hance p rod uction.   On  the  oth e ha nd,  the   im age  bec om es  m or an m or in di sp e ns able  i se ver al   fiel ds   a nd  esse ntial ly  in  com m un ic at ion   betwee pe op le I nd ee d,   t he  ex pone ntial   dev el op m e nt  of   c omm un ic ation   m edia  on   t he  one   hand,   a nd   di gital   storag m edia  on   the  oth e r   hand,   ha ve  en or m ou sly   trans form ed  the  way  we  co m m un ic at e.   These   ne te c hnologies  a re  ba sed  e ssentia ll on  the   ef fici ent  e xch a nge  a nd  st or a ge  of  m ultim edia  data  and  i par ti cu la r digit al  i m ages,  he nc e the  nee f or  i m age en c rypt ion  al gorithm s.   In   w hat  f ollo w s,  we   disc us t he  desig a nd  reali zat ion   of   t he  m idd le - squ are  ge ne rato i the   co ntext  of   pr oducin pse udo - ra ndom   seq uen ces The   si m plistic  of   m idd le - squa re  gen e rato can  be  ex plo it ed  f or  go od   rand om   sequ ence.  I or der   t eval uate  these  sequ e nces  and   validat our   gen e rato r,   we  i m ple m ented  five   sta ti c test s .       Evaluation Warning : The document was created with Spire.PDF for Python.
                          IS S N :   2088 - 8708   In t J  Elec  &  C om En g,   V ol.  9 , N o.   6 Dece m ber  2 01 :   5615   -   5627   5616   This  pa per   is  structu re as  fo ll ows.  Sect io intr oduces   so m e   basic  pri nciples  of   ps e udo - ra ndom  nu m ber   ge ne ra tor.   Sect i on  3   di scusses  the f or m at ion   of   m idd le   square g e ne rator,  outl inin the p r ocedu r with  an  e xam ples.  S ect ion   pr ese nts  va rio us  ty pe of  te sti ngs  pur posedly   to   e valuate  th qual it of   our   pr opos e m et ho d.   Sect i on   repo rts  the  fin dings  ac cordin to  va r iou te sts  pro po s ed  earli er  Sect ion   c oncl ud es    our   st ud ie s .       2.   PSEU DO - R A NDOM  GE N ERATO RS   The  nee f or  rando m   num ber is  felt  in  m any  app li cat ion of  crypto gr a phy.   In   com m on   crypto gr a phic   syst e m s,  the k e ys (num ber s)  t hat are use m us t be  r a ndom l y gen e rated . For   e xam ple, when o ne   consults  on  th In te rn et   his  e - m ail  accounts  or,  w hen  one   carries   out  a orde by  I nter net  s om "sensit ive"  inf or m at ion   (your  acce ss  c od or   y our  cre di card   nu m ber )   m us rem a in  confide ntial   to  ens ur a uth e nt ic ity,  nobody  s hould  be  able  t ac cess  the  acco unts  or  orde w it the  car d.   T ens ure  these   functi ons,  I nt ern e t   protoc ols  hav e   bee pu t   in  pl ace.  They  al l ow  yo to   ent er  yo ur  co des   on  web  pa ge   with ou t he  risk  of     an  outsi de  pe rson  ha ving  a ccess  to  them These  pr otoc ols  us ra nd om   nu m ber to  enc rypt  dat and   pr e ve nt sp yi ng .     2.1.   Def ini ti on   of  a ran do m  seq u ence   In   m at he m at ics,   rand om   se qu e nce,  or   ra ndom   infin it sequ e nce,  is  s equ e nce  of   sy m bo ls  of   an   al ph a bet  ha vin no   str uctu re,  no  re gu la r it y,  or   identif ia ble  pr e dicti on   r ule  [ 11 - 12 ] Su ch  seq uen c e   corres ponds  to  the  intuit ive   no ti on  of  nu m ber dr aw at   ran dom sequ e nce  of  rand om   nu m ber is    sequ e nce  of  nu m ber ra ndom ly  cho se n.   T his  seq uen c ha the  pro per ty   that  we  canno pr edict   the  nu m ber to co m e from  t he  al rea dy  known  num ber s , w hateve they  a r e   [ 13 ] .     2.2.   Def ini ti on   of  a pseud o - ra nd om  seque nce   The  ps e udo - ra ndom   te r m   is  us e in  m at hem at ic and   co m pu te sci ence   to  de sig nate  a   seq uen ce   of   nu m ber that  a ppr oach es  st at ist ic ally  per f ect   hazard   [14 - 16 ] By   the  al gorithm ic   pr oce sses  us e to  cr eat i t   and   t he  s ource us e d,   t he  se qu e nce  ca nnot   be  c om plete l con si der e a truly  ra ndom .   ps eu do - r andom   seq uen ce   (Pse udo  Ra ndom   Sequ e nce  i E ngli sh )   [ 17]   is  a   seq ue nce  of  intege rs  x 0 x 1 ,   x 2 ...  ta king  it val u es  in  the  set   {0,   1,   2,   ... ,   m - 1}.   The  te rm   x n   (n 0)   is  the  resu lt   of  a   cal culat ion  (to  be  de fine d)   on   the  pre vious   te rm   (s) The  first  te r m   x 0   is  called  the  se ed W it the   sam init ial  seed,     the  seq uen ce  of  ps e udoran do m   nu m ber produce by  the   ps eu dora ndom   nu m ber   generator  is  dete r m inist i c   and can  the refor e  b e  r e pro duced.   ps e udo - ra ndom   nu m ber   ge ner at or  is  a al gorithm   that  ge ner at es  a   seq uen ce   of  num ber wit certai pro per t ie of  c han ce The  pri nciple   of  these   ge ne r at or s   is  to   crea te   from   an  init ia seed,   s o - cal le ps e udo - ra ndom   nu m ber , whi ch has  no appa ren t l ogic al  or  arit hm etic connecti on w it h t he  seed. T his g e ner at e nu m ber   is  then   us ed  to  create   second  ps e udo - ra ndom   num ber W ca thu rec ursivel gen erate  se ries  of  nu m ber that  do  not  ap pea to  ha ve  a ny  logi cal   li nk   in  t he ir  seq uen ce but  w hich  a re  in  fact  al obta ined  by     determ inist ic  f or m ula.  T his  cl ass  of  ge ne rators  is  easy   to  im ple m ent  and  al lo ws  high  th r oughputs  wh il e   pro du ci ng   s uites  that  hav go od   sta ti sti cal   pr operti es.  It  is  therefo re  ver su it able  for  ap plica ti on that  do   no t   require  the  un pr e dicta bili ty   of   the  su it es  (s uch   as  dig it al   si m ulati on ),   but  can  al so   be  us e in  cry ptogra phic   app li cat io ns   prov i ded that ce r ta in cr it eria are  m e t.       3.   MIDDLE  S Q UARE GE NE RA TO R   This  gen e rato is  base on  th e   m edian  sq ua re   m e t ho d,  kn own  in  t he  E ng li s li te ratur al so   as  m idd le   sq ua re,   wa in ven te by  the   Am erican - H ungar ia m at he m at ic ia an physi ci st  Jo hn  V on  Ne um ann   i 1946.   The  m idd le   s quare   is  c onsid ered  as  t he  fir st  m e tho of  autom at ic   generati on  of  ps e udoran dom   num ber s.     T he  pri nciple  of   this  m et ho is  ver sim ple,  we  ge ne r at sequ enc of   num ber each  ha ving  2k  dig it s     (ev e nu m ber ) The   su cc esso of  num ber   in  this  se qu e nc is  obta ined   by   raisi ng   t his  nu m ber   s quare a nd   then ret ai ning t he 2k m idd le  num ber s.  T he pr incipl e of t his  m et ho is  d esc ribe d by the  fo l lowing  ste ps :     Start wit h a see d (a  nu m ber )  of  n - dig it  (n  dig i ts),     Ra ise  squar e t o get a  nu m ber o f 2n di gits, a dd zer os  i f nec essary,     Take t he  m idd le  n   num ber s as  the  nex ra ndom  n u m ber ,     Re peat 1 - 2 - (t he pr ocess ).         Evaluation Warning : The document was created with Spire.PDF for Python.
In t J  Elec  &  C om En g     IS S N: 20 88 - 8 708       Crypto graphic   adaptati on  of t he mid dle s quare  g e ner ato r  (Han Ali - P ac ha)   5617   Exam ple   If   w gen e rate  4 - di git  nu m ber f r om   35 67,  we  ge 72 34  as  the  nex val ue  sinc the  3 56 7   sq ua re  is  e qu al   to  1272 3489,   c on ti nuin in  t he  sam way,  the  ne xt  num ber   will   be   3307 ,   3567,  7234,   3307,   9362  6470,   8609,   11 48,  31 79,  1060,  1236,  5276,  836 1,  9063,  1379,   9016,   28 82,  30 59,  3574,  7734,  81 47 ,   3736,  9576,   6997,   95 80,  77 64,  2796,   81 76,  8469,   7239   4031,   24 89,   1951,   8064,  280,  78 4,  61 46,  7733 7992,  8720,   384,  1474,  1726,  9790,   84 41,   2504,   27 00,  2900,  4100,   8100,   61 00,  2100,  4100 a nd   so   on .     The   res ulti ng  s equ e nce  retu r ns afte r  46 iterat ion s  in  a  p e rio dic or bit .       4.   TE ST A GE N ERATO R   Determ ining   w hethe gen e r at or   is  rand om  or  not  is  tric ky  pro blem Indeed,  the re  is  no  unive rsal   te st,  that  can  s ay   with  certai nty  that  generator  is  rand om   [18 - 19] T he   pr in ci ple  is  to  sho that  it   is  no biased  by  study ing   the  pro pe rtie of   the  num ber it   gen erates.  I pr a c ti ce,  ran dom   gen e rator   pro du ce s     sequ e nce  of  nu m ber with  pro per ti es  of   unpre dicta bili ty  [ 20 - 22 ]   an ind e pe nd e nce,  and   fo ll ows  certai dis trib ution   (unif or m   in  cryptography,  Ga ussi an  in  te le co m m un ic at ion s,   et c.).   The  e va luati on   of  the  r andom   qu al it of   ge ner at or   th us   passes  th rou gh  the  con tr ol  of  the  prop e rtie of   the  seq ue nc that  it  gen e rates.     This  is  achieve thr ough  sta ti sti cal   te sts   that  com par the  per f or m ance  of   the  gen e rato s tud ie c om par ed  to   tho se , th e or et ic al .   The  pur pose of  stat istica te sts  is to  m easur e the quali ty  o rand om sequ e nc e.  W e can  co nc lud e that   su it ge ner at ed  by  PR NG  is  rando m   and  of   good  qual it y,  if  it   sat isfie these  te sts.  Th eref or e sta ti sti cal   te st  can  in  no  way  guara ntee  that  giv e se qu e nce  is  ra nd om The  on ly   inf or m at ion   tha sta ti st ic al   test  can  pro vid is  that   the  seq ue nce  seem ran do m .   Seve ral  sta ndar ds   e xist  to  evaluate  a nd   c erti fy  the  qual i ty   of   ps e udor a ndom   nu m ber   ge ne rators.  W will   pr ese nt  so m te s ts  us ed  to  eval uate   the  perform a nce  of     our ge ner at or .     4.1.   Entropy   tes t   An   e ntr op ca lc ulate the  am ou nt  of   in f orm ation   co ntained  i file The  file   is  co ns ide red   a s     a seq ue nce  of   words  of   1 o r 8   bits. T he  e ntr opy i s calc ulate as  sho wn b el ow :     ( ) = ( ) .  2 ( 2 1 = 0 ( ) )       W he re  is  the   stud ie s ource P i   is  the   pro ba bili ty   of   ap pe aran ce  of  the  word  of  bit s.   T he  com pu t at ion   of   the  ent ropy  m akes  t he  m inim u m   nu m ber   of  bits  per  w ord  c onta inin al the  in f orm at ion .   F or  e xam ple,   if  the  e ntr opy  is  bits/ w ord  for  8 - bit  w ords   the bits  car ry  re dund ant  in form at io a nd  the   file   co ul theo reti cal ly  b e com pr esse t th ree  quarter s of its  or igi nal size .     4.2.   Mean,  st an d ar de viation  and  au t o - correl at i on   fa c t or   This  is  the  si m plest  te st  po s sible.  It  con sist of  cal culat ing   t he  m ean,  the  va riance  a nd     the  autoc orrela ti on   facto of  the  ps e udo - ra ndom   sequ e nce.   L e t   x i ,   f or   i   1,   2,   . . ,   n,   be   a   s e qu e nc e   ob t a i ne f r om   a   ps e ud o - r a n d om   num be r   ge ne r a t or .   T h e   s e qu e nc e   of   u i =x i / n,   f or   i   =   1,   2,   . . ,   i s   a   se qu e nc e   o f   ps e ud o - r a nd om   num be r s   di s t r i bu t e u ni f or m ly   i t he   i nt e r va l   [ 0, 1] .   F or   a   r a nd om   se qu e nc e ,   t he s e   f a c t or s   t e nd   t o w a r ds   i de a l   va l ue s ,   w hi c a r e   t hu s   s uf f i c i e nt   t c om pa r e   w i t th e   c a l c ul a t e va l ue s   f or   t he   f ol l ow i ng   U .   I de a l l y ,   w e   m us t   f i nd   th e   t hr e e   va l ue s   be l ow :     a)   Av e ra ge:   = 1 . = 1 = 1 2 .   b)   Var ia nce:   = 1 . ( 2 2 ) = 1 12 .     c)   Au t C orrelat ion = 1 . ( + 1 ) = 1 4 1 .       4.3.   Spectr al  te st   The  i dea  is  to   visu al ly   re pr es ent  the  s eq ue nc of  pse ud o - r andom   nu m bers  in  dim e ns i on  ( 1D),  2D  and  3D.   F or  3D  Re pr ese ntati on ,   th ree  c onse cutive  values   will   be  t he  c oord i nates  of   a   point  i s pace.   We  l ook  at   wh et her   t he  po i nts  are  eve nly  distrib uted   in  c ub e .   B y   t ur ni ng   t he   c ub e   a s   s ho w i F i gu r e   1 ,   o ne   s e e s   a n   un de s i r a bl e   e f f e c t   a pp e a r ,   t ha t   i t he   pl a ns   of  M a r s a gl i a   [20] .   I t   i c l e a r   be l ow   t ha t   t he   poi nt s   a r e   l oc a te on   pl a ns .   I f a c t ,   a l l   l i ne a r   c on gr u e nt i a ge ne r a t or s   ( L C G )   s uf f e r   f r om   t hi s   e f f e c t   ( t hi s   i s   du e   to   t he   f a c t   t ha t   w e   do   no t   ge ne r a t e   a l r e a l s ,   bu t   o nl y   f r a c t i on s ) .   T he   sm a ll e r   t he   i nt er - pl a na r   di s t a nc e ,   t he   be t t e r   t he   ge ne r a t or .         Evaluation Warning : The document was created with Spire.PDF for Python.
                          IS S N :   2088 - 8708   In t J  Elec  &  C om En g,   V ol.  9 , N o.   6 Dece m ber  2 01 :   5615   -   5627   5618       Figure  1. Ma rs aglia   shots         4.4.   Pok er   tes t   The  idea  of  thi te st  is  to  com par t he  the or e ti cal   fr eq uen ci es  of   ha nds  in  poke with  t he  fr e qu e ncies   ob s er ved  by  si m ula ti ng   these   ha nd s   (a   ha nd   is   set   of   ca r ds ) re su lt   ca be  c on si der e as  a orde re li st  of   4 digit s.  T he re  are in  all  10 4 The  t heoreti cal  proba bili ti es o btained  are  as  f ollows:   a)   F or   di f f e r e nt   di gi t s   ( e g.   15 74 ) ,   t he   n um be r   of   p os s i bl e   c a s e s   i s   10   *   7,   10   f o r   t he   f i r s t   nu m be r ,     f or   t he   ne xt ,   a nd   s o t he   p r ob a bi l i ty   i s   t he r e f or e   ( 1 7)   /   1 00 0 0.   b)   F or   a   pa i r ,   t y pe   A B C C   ( e g.   4 84 9) ,   w e   ha ve   10   w a y s   t m a ke   it ,   t m ul t i pl y   by   t he   nu m be r   o f   w a y s   t pl a c e   t he   pa i r   a m on t he   p os s i bl e   pl a c e s :   T he   pr o ba bi l i ty   i s :   ( 4 2 ) 10 9 8 10 4 .   c)   F or   a   do ub l e   p a i r ,   t y pe   A A B B   ( e x:   73 37 ) ,   w e   ha ve   10   w a y s   t c ho os e   t he   f i r s t   nu m be r ,   t he w a y s   t c ho os e   t he   s e c on o ne   ( w hi c m us t   be   di f f e r e nt ) ,   i a l l   10   =   90   c ho i c e s ,   t m ul ti pl y   by   t he   nu m be r   o f   w a y s   t pl a c e   t he s e   nu m be r s   a m on t he   p os s i bl e   pl a c e s   (   1 2 ( 4 2 )   =   3) ,   t he   pr ob a bi l i ty   i s   =   1 2 ( 4 2 ) 10 9 10 4 .   d)   F or   t h r e e   i de n t i c al   di gi t s ,   t yp e   A A A B   ( e x :   55 1 5) ,   t he r e   a r e   1 w a y s   t m a ke   i t ,   t m ul t i pl y   by     t he   nu m be r   of   w a y s   t pl a c e   t he   t hr e e   di gi t s   am on t he   po s s i bl e   pl a c e s ,   th e   pr ob a bi l i ty   is   =   ( 4 3 ) 10 9 10 4 .   e)   Finall y, f or   f our  ide ntica l digit s ( e x: 44 44), i t i worth   10 10 4 = 0 . 001   No te  t hat the  s um  o these  f i ve  proba bili ti es g ives  1.       5.   RESU LT S  AND INTE RP RETATIO N   The  resu lt a r m ade  un de PC  TO S H IB A,   on  w hich   is  instal le W i ndows  ( 32  bits),  R AM:  4.00 GB,  AMD   E - 45 A PU  proces sor  with   Ra deon  ( TM)  HD   G raphics  1.65   G Hz.   T he   functi ons  devel op e us in M ATL AB  [ 23 - 24]   al low  us  to  ge ne rate  pse ud o - r andom   sequ e nc es  an a naly ze  their  pe rform ance.   Figure  i ll us tr at es  the  se que nce  of  ps e udo  rand om   nu m ber acc ordin t the  Von  Ne um ann   m edial   sq ua re  m et ho d,   we  t ake  as  par am et er  represe nting   t he  le ngth  of   t he  s e qu e nce  6553 6,   a nd   t he   seed   x0 =  236589 741.   Af te r gene ra ti ng  the  s uite,  we  a pp li ed  stat ist ic al  t est s to  evaluate i t.       Evaluation Warning : The document was created with Spire.PDF for Python.
In t J  Elec  &  C om En g     IS S N: 20 88 - 8 708       Crypto graphic   adaptati on  of t he mid dle s quare  g e ner ato r  (Han Ali - P ac ha)   5619       Figure  2. Ra nd om   data su it e       5.1.   Te st 1:   mea n stand ard devi at i on   an d  aut o - c orrela tion f actor   Table  il lustra te s sev e ral te sts wit h t he  sam e seed  and  of di ff ere nt  value n :       Table  1 .   Me a n,  sta ndar d dev ia ti on  a nd au t o - c orrelat ion   fac tor   Test   Seed   n   Mean   Au to - Co rr elatio n   Variance   1   5746   5000   0 .52 1 7 4 8   0 .27 2 4 0 4   0 .05 2 6 8 9   2   1 0 0 0 0   0 .52 1 7 9 7   0 .27 2 3 6 3   0 .05 2 5 2 0   3   2 0 0 0 0   0 .52 1 8 2 1   0 .27 2 3 4 3   0 .05 2 4 3 5   4   6 5 3 3 6   0 .52 1 8 3 8   0 .27 2 3 2 9   0 .05 2 3 7 6   5   2 3 6 5 8 9 7 4 1   5000   0 .50 9 8 3 4   0 .26 0 2 5 8   0 .08 2 7 5 8   6   1 0 0 0 0   0 .5 0 7 5 8 8   0 .25 7 6 2 9   0 .08 3 0 9 7   7   2 0 0 0 0   0 .50 4 4 8 1   0 .25 4 2 4 8   0 .08 3 0 5 4   8   6 5 3 3 6   0 .50 4 0 3 2   0 .25 4 1 0 5   0 .08 3 5 2 3   9   6 5 3 3 6   0 .49 4 6 6 0   0 .24 4 0 5 6   0 .08 3 4 6 2   10   2 3 6 5 8 9 7 4 1   5000   0 .50 9 8 3 4   0 .26 0 2 5 8   0 .08 2 7 5 8   11   2 3 6 6 8 4 7 4 1   6000   0 .50 1 7 2 8   0 .25 1 2 0 7   0 .08 3 3 0 0   12   2 8 9 7 8 4 7 4 1   7000   0 .49 6 6 6 4   0 .24 7 9 7 7   0 .08 4 1 1 9   13   2 3 6 5 8 9 7 4 1   5000   0 .50 9 8 3 4   0 .26 0 2 5 8   0 .08 2 7 5 8   14   6000   0 .50 9 9 8 4   0 .25 9 9 6 0   0 .08 3 1 8 8   15   7000   0 .51 1 1 3 0   0 .26 0 5 9 8   0 .08 3 0 1 2       No te   t hat  Test   c orres ponds   to  t he  sta nda r se quence   of  the  co ntin uatio of  Test   8.  A ccordin t the  resu lt obta in ed  an afte sever al   te sts,  it   has  been   fou nd   that  with  suffici entl la rg e,  and   with   su f fici ently   la rg see ( of  la r ge  di git  or  6)  the  cal c ulate val ues  gr a du al ly   te nd   towa r ds   the  i deal  as  sh ow in Figu re  ( Te st 8).    Evaluation Warning : The document was created with Spire.PDF for Python.
                          IS S N :   2088 - 8708   In t J  Elec  &  C om En g,   V ol.  9 , N o.   6 Dece m ber  2 01 :   5615   -   5627   5620       Figure  3 .   The   gr a phic al  curv e o the  thr e e c al culat ed value s       5.2.   Te st 2:   th e  spe ctra test   This  te st  ai m to  a naly ze  the   di stribu ti on o f  points  i 2D  a nd 3 D   s pace,   Fi gure 4   il lust rates  the v is ual   represe ntati on   of   the  se qu e nc gen e rated  (T est   8) I the  3D  represe ntati on,  by  ro ta ti ng   the  cub e,  on visu al ly   no ti ces  the   ab sence  of   t he  Ma rsag li pla nes  a nd  the  points  a re  unif or m ly   distribut ed,   this  im pli es  that     the test ed  s uite  is ra ndom             Figure  4.   Distri bu ti on  of  value s in 2D a nd 3D       5.3.   Te st 3:   freq ue ncy tes t   Re cal that  this   te st  ev al uates  wh et her   the  se qu e nce  is  ra ndom   by  co m par ing   the  cal c ulate P - val ue   with  th sig nifi cance  t hr es hold  α  ( ta king  α   =   0.0 1).  I P - val ue  >   α the t he   seq ue nce  is r andom   oth er wi se  it   is   no ra ndom The  sta ndar di zed  P - value  c olu m corresponds  to  the  norm a li zed  sequ ence  (in  m od   256).     The res ults are  pr ese nted  in T able 2.       Table  2 .   Fr e quency te st res ults   Test   n   Seed   P - v alu e   P - v alu (no r m alized )   Interpretatio n   1   5000   2 3 6 5 8 9 7 4 1   0 .92 5 1   0 .78 7 8   +   2   1 0 0 0 0   0 .98 8 5   0 .56 3 7   +   3   2 0 0 0 0   1   0 .38 0 6   +   4   6 5 5 3 6   1 .54 0 3   0 .04 4 7   +       No te   t hat  f or  al four   te sts,   the  P - va lue  is  gr eat er   tha α ,   so   we  ac cept  the  null   hy po t hesis  wh i c sta te s that "t he se quence  is ra ndom "   Evaluation Warning : The document was created with Spire.PDF for Python.
In t J  Elec  &  C om En g     IS S N: 20 88 - 8 708       Crypto graphic   adaptati on  of t he mid dle s quare  g e ner ato r  (Han Ali - P ac ha)   5621   5.4.   Te st 4:   e nt r opy  test   In   Ta ble  we   find   t he  ent ropy  value f or   the  norm al iz ed  sequ e nces  with  dif fe ren n,   the  highe r     the  e ntropy,   th m or ra ndom  the  s eq ue nce  i s.  I the  i deal  c ase  the   entr opy  val ue  is  e qual   to  8.   N ote  that  eac tim e the v al ue of  n is i nc rease d,  t he value  of  the en t ropy als inc reases .       Table  3 .   E ntr opy t est  r es ults   Test   n   Seed   Entro p y  ( n o r m aliz ed )   1   5 000   2 3 6 5 8 9 7 4 1   7 .96 2 8   2   1 0 0 0 0   7 .97 9 3   3   2 0 0 0 0   7 .98 9 9   4   6 5 5 3 6   7 .99 3 4       5.5.   Te st 5:   poker  test   The  pu rpose  of   this  te st  is  to  com par the  theo reti cal   prob a bili ti es  Pt  of   po ker  hands  with     the  pro bab il it ie ob s er ved   Po   by  si m ulati ng   these  ha nds  (a  s et   of   car ds).  N oting   here  that  the  Po   a re  obta ine by d i vid in t he  observe d fr e quencies  of eac case  on t he  t otal n um ber  n.     5.5.1.   For 4's h and   This ti m e w e cal culat e the the or et ic al  pr ob a bi li t ie s,  with  =  4   s how i Ta ble 4 .       Table  4 .   T he oret ic al   pr oba bili ti es f or  han d p ok e r of 4     4  dif f erent car d s   1  pair on ly   d istin cts   p airs   3  iden tical car d s   4  iden tical car d s   n   Pt   0 .50 4   0 .43 2   0 .02 7   0 .03 6   0 .00 1     Po   0 .46 0 0   0 .44 0 0   0 .06 0 0   0 .03 0 0   0 .01 0 0   100   0 .00 9 2   0 .98 8 8   0 .00 1 2   0 .00 0 6   0 .00 0 2   5000   0 .00 4 6   0 .99 4 4   0 .00 0 6   0 .00 0 3   0 .00 0 1   1 0 0 0 0   0 .00 0 2 3   0 .99 7 2   0 .00 0 3   0 .00 0 1   0 .00 0 1   2 0 0 0 0   7 .01 9 * 1 0 - 4   0 .99 9 1   9 .15 5 * 1 0 - 5   4 .57 7 * 1 0 - 5   1 .52 5 * 1 0 - 5   6 5 5 3 6       5.5.2.   For 3  hand   The  sam pr inciple   is  us ed  to  cal culat the  t heoreti cal   pr ob abili ti es,  bu this  tim with  3.   In   thi s   case t he  te st i app li ed  to   t he  s ta nd a rd seque nc e or the  num ber   of   dig it reduced  to 3   sho w in  Ta ble 5 .       Table  5 .   T he oret ic al   pr oba bili ti es f or  hand p ok e of  3     3  dif f erent car d s   1  pair on ly   3  iden tical car d s   n   Pt   0 .72 0 0   0 .27 0 0   0 .01 0 0     Po   0 .64 0 0   0 .36 0 0   0 .02 0 0   100   0 .69 8 2   0 .28 9 8   0 .01 2 0   5000   0 .70 4 2   0 .28 4 6   0 .01 1 2   1 0 0 0 0   0 .70 1 4   0 .28 6 4   0 .01 2 2   2 0 0 0 0   0 .70 3 2   0 .28 4 4   0 .01 2 4   6 5 5 3 6       5.6.   Encr ypting  ima ges   Using  the  MA TLAB  softwa r e,  we  hav devel op e an  ap pl ic at ion   to  encry pt  and   dec ryp an  i m age,   us in t he  valu es  pro duced   by   the  m idd le   sq ua re  ge ner at or,  as so ci at ed   w it the  X OR  s ymm et ric  encry ption  te chn iq ue.  T he   X OR  1   di git  ha nd le s   the  bi ts,  base on  th operati on  or  exclusi ve  bitwise  ( XO R as  s how in Figu re  5.           Figure  5 .   Pr i nc iple o e ncr ypti on   Evaluation Warning : The document was created with Spire.PDF for Python.
                          IS S N :   2088 - 8708   In t J  Elec  &  C om En g,   V ol.  9 , N o.   6 Dece m ber  2 01 :   5615   -   5627   5622   We  us as  ke bit  string   of   g ive le ng t L.  It  is  encr y pted  by  pe rfor m ing   the  exclusi ve - or  op e rati on  bit  by   bit  of  t he  ke with  t he  cl ear  te xt,   di vid ed   int blo c ks  of  le ngth  each Re cal l   that   the  excl us ive - or   is  ass ociat iv e,  com m utati v and,  that  it   ha ne utral  el e m ent  0,   a nd   t hat  any  c hain  is  it s   own  in ve rse:  K K   0.  T hu s we  can  s ee  that  the  de crypti on  al gori thm   is  identic al   to  the  enc r ypti on   al gorithm , w it the  sam e k ey :     M = C =  (M K)  K  =   M   (K K =  M =  M     The  ba sic   idea  of   this  pr oce ss  is  to  perfor m   an  "exclusi ve"  or  " ",  bi by  bit  between   the  key   gen e rated  by  PRNG,  an th i m age  to  be  encr y pted,   IO.  This  al gorithm   is  co m plete ly   sy m m e tric al t hat  is  the  sam e   op era ti on   is  app li ed  again  to  the  en crypted  im age,  IC  to  find   the  or i gin al   i m age.  The  i m ages  us ed  in   our  a ppli cat ion are as  in Fi gur e 6  a nd  of si ze  256x25 6.   We  pr ese nt  in   the  f ollo wing   Fig ur es   7 - 14  i m ages  of  the  two  im ages  "E I:  I nnoce nt  Ch il dr en"   a nd   "FA:  Alge rian  Wo m an"  acco r ding  to  dif fer e nt  seeds  to  see  the  influ e nce  of  the  siz of   th seed  in  this  ci ph e r .   No te   that  the  encr y ption   of   t he  im ages  ha fail ed  with  seq uels  that  ha ve  see of  2,  3,   4,   or   dig it s .   Fr om   these  resu lt we  can  co nclu de  that  to  qu a ntify  an  im age  it   is  necessary  that  the  seed  is  su f fici ently   wide  (larg e  d i git i s great er tha n 6 ).   This c onfirm s the c ond it io m ade  by Vo n Ne um ann  usi ng   10 - dig it   nu m bers.                 Figure  6 .   IO - E   IO - FA                 Figure  7 .   IC - EI     IC - F A wit seed= 26         Figure  8 .   IC - EI     IC - F A wit seed= 684                 Figure  9. IC - EI     IC - F A wit seed= 2863     Figure  10. IC - EI    IC - F A wit see d= 43295   Evaluation Warning : The document was created with Spire.PDF for Python.
In t J  Elec  &  C om En g     IS S N: 20 88 - 8 708       Crypto graphic   adaptati on  of t he mid dle s quare  g e ner ato r  (Han Ali - P ac ha)   5623             Figure  11. IC - EI    IC - F A wit see d= 928763         Figure  1 2.   IC - EI    IC - F A wit see d= 854726 7                 Figure  13. IC - EI    IC - F A wit see d= 594126 78     Figure  14. IC - EI    IC - F A wit h   see d= 236589 741       5.7.     Analysis  of  hi stogr ams   histo gram   is  st at ist ic a c urve  in dicat ing  the  distrib utio of  the  pi xels   of   a i m age  accor ding  to   their  value I our  w ork,   processe im age are  gr ay scal i m ages  wh ose   pix el   val ue var in  the  range     [0,  25 5].  We  ha ve  dr a w an analy zed  t he  histo gr am of   the  enc rypte i m ages  of  "EI -   Inn oce nt  Chil dr e n"   and  "FA - Alge r ia Wo m en",  the  il lustrate pl ots  the  histo gra m of   the   enc rypted  im ages,   HC  of   t he  im ages     EI  a nd  F re sp ect ively   acc ordin t the   siz of  the  se ed.   N ote  that,   the  historg ra m   fo the  plai ntext  is     denoted  as  HP .   It  th us   em erges  f ro m   the  prece di ng  res ults  that  the   histogram of   Fig ur es   21 - 23  a r unif or m ly  distrib uted  wit res pect  to  th histogram of   the  or i gin al   im ages  from   Fi gure  15  with  r especti ve  enc r ypte i m ages  fr om   Figures  16 - 20  ( there  is  le ak age  of  inf o rm at ion   ab out  th pix el   distri buti on   of   t he  im ages)   This  m akes  cryptanaly sis  increasin gly  diff i cult  becau se  th encr ypte i m ages  pro vid no  el e m ent,  bas ed  on   the exploit at io n of t he hist ogr a m , to  d e sig a  stat ist ic al  att a ck on t he p rop os e im age encrypti on tech ni qu e .             Figure  15 .   HP - EI    HP   FA   Evaluation Warning : The document was created with Spire.PDF for Python.
                          IS S N :   2088 - 8708   In t J  Elec  &  C om En g,   V ol.  9 , N o.   6 Dece m ber  2 01 :   5615   -   5627   5624         Figure  16. HC - EI    HC - F A w it seed= 26             Figure  17. HC - EI    HC - F a ve seed= 684             Figure  18. HC - EI    HC - F A w it seed= 2863   Evaluation Warning : The document was created with Spire.PDF for Python.