[svn] / ecrypt / trunk / benchmarks / rc4 / rc4.c  

svn: ecrypt/trunk/benchmarks/rc4/rc4.c

Diff for /ecrypt/trunk/benchmarks/rc4/rc4.c between version 50 and 51

version 50, Thu Aug 4 20:12:18 2005 UTC version 51, Thu Aug 4 22:11:59 2005 UTC
Line 39 
Line 39 
 {  {
   u32 i, j;    u32 i, j;
   
   #if (ECRYPT_VARIANT == 1)
     u8* s = (u8*)ctx->s;
   #else
     u32* s = (u32*)ctx->s;
   #endif
   
   for (i = 0; i < 256; ++i)    for (i = 0; i < 256; ++i)
     ctx->s[i] = i;      s[i] = i;
   
   for (i = j = 0; i < 256; ++i)    for (i = j = 0; i < 256; ++i)
     {      {
       u32 a;        u32 a;
   
       j = (j + (a = ctx->s[i]) + ctx->key[i % ctx->keylen]) & 0xFF;        j = (j + (a = s[i]) + ctx->key[i % ctx->keylen]) & 0xFF;
       ctx->s[i] = ctx->s[j];        s[i] = s[j];
       ctx->s[j] = a;        s[j] = a;
     }      }
   
   ctx->i = 0;    ctx->i = 0;
Line 62 
Line 68 
     u32 a, b;                                                                 \      u32 a, b;                                                                 \
                                                                               \                                                                                \
     i = (i + 1) & 0xFF;                                                       \      i = (i + 1) & 0xFF;                                                       \
     j = (j + (a = ctx->s[i])) & 0xFF;                                         \      j = (j + (a = s[i])) & 0xFF;                                         \
                                                                               \                                                                                \
     ctx->s[i] = b = ctx->s[j];                                                \      s[i] = b = s[j];                                                \
     output[n] = ctx->s[(b + (ctx->s[j] = a)) & 0xFF];                         \      output[n] = s[(b + (s[j] = a)) & 0xFF];                         \
   } while (0)    } while (0)
   
   
Line 79 
Line 85 
   u32 i = ctx->i;    u32 i = ctx->i;
   u32 j = ctx->j;    u32 j = ctx->j;
   
   #if (ECRYPT_VARIANT == 1)
     u8* s = (u8*)ctx->s;
   #else
     u32* s = (u32*)ctx->s;
   #endif
   
   for ( ; (int)(msglen -= 16) >= 0; output += 16, input += 16)    for ( ; (int)(msglen -= 16) >= 0; output += 16, input += 16)
     {      {
       ITERATE( 0); ITERATE( 1); ITERATE( 2); ITERATE( 3);        ITERATE( 0); ITERATE( 1); ITERATE( 2); ITERATE( 3);


Generate output suitable for use with a patch program
Legend:
Removed from v.50  
changed lines
  Added in v.51

eSTREAM Project

Powered by ViewCVS 1.0-dev
(Powered by Apache)

ViewCVS and CVS Help