Re: Looking for Source of AES code

2004-09-14 Thread Brian Gladman
Damien O'Rourke wrote:
Hi,
I have some AES code here in C and I am trying to find it's author and
source.  I can't find
it on the Internet so I figure it was taken from a book.  Now I don't want
to send the entire
code to the list for obvious reasons however I was hoping you could help me
from the following
small snippet.  Maybe the use of  _fastcall  might jog someone's memory.
If there is
code that appears similar to this but is not exactly the same I would
appreciate the source
of that also.
void _fastcall encrypt(FILE *Encryption_File, FILE *Encrypted_File, unsigned
*expkey)
{
uchar in[16], out[16];
unsigned state[NumberOfBytes], rnd, i;
while (!feof(Encryption_File))
{
  uchar k=0;
   fread(in,sizeof(uchar),16,Encryption_File);/
   *(state+0)= *(in+0)24 | *(in+1) 16  | *(in+2)8  | *(in+3);
   *(state+1)= *(in+4)24 | *(in+5) 16  | *(in+6)8  | *(in+7)  ;
   *(state+2)= *(in+8)24 | *(in+9) 16  | *(in+10)8 | *(in+11)  ;
   *(state+3)= *(in+1)24 | *(in+3) 16  | *(in+14)8 | *(in+15)  ;
I don't know whose code it is but it has bugs in it.
The line above should be:
 *(state+3)= *(in+12)24 | *(in+13) 16  | *(in+14)8 | *(in+15);
I doubt that this is the only problem in this code either.
[snip]
Brian Gladman
-
The Cryptography Mailing List
Unsubscribe by sending unsubscribe cryptography to [EMAIL PROTECTED]


Looking for Source of AES code

2004-09-13 Thread Damien O'Rourke
Hi,

I have some AES code here in C and I am trying to find it's author and
source.  I can't find
it on the Internet so I figure it was taken from a book.  Now I don't want
to send the entire
code to the list for obvious reasons however I was hoping you could help me
from the following
small snippet.  Maybe the use of  _fastcall  might jog someone's memory.
If there is
code that appears similar to this but is not exactly the same I would
appreciate the source
of that also.


void _fastcall encrypt(FILE *Encryption_File, FILE *Encrypted_File, unsigned
*expkey)
{
uchar in[16], out[16];
unsigned state[NumberOfBytes], rnd, i;

while (!feof(Encryption_File))
{
  uchar k=0;
   fread(in,sizeof(uchar),16,Encryption_File);/

   *(state+0)= *(in+0)24 | *(in+1) 16  | *(in+2)8  | *(in+3);
   *(state+1)= *(in+4)24 | *(in+5) 16  | *(in+6)8  | *(in+7)  ;
   *(state+2)= *(in+8)24 | *(in+9) 16  | *(in+10)8 | *(in+11)  ;
   *(state+3)= *(in+1)24 | *(in+3) 16  | *(in+14)8 | *(in+15)  ;

   AddRoundKey (state, expkey);

 for( rnd = 1; rnd  NumberOfRounds + 1; rnd++ )
 {
  ByteSub((uchar *)state);
  ShiftRows ((uchar *)state);
  if( rnd  NumberOfRounds )
MixColumns ((uchar *)state);
  AddRoundKey (state, expkey + rnd * NumberOfBytes);
 }


Many Thanks,
Damien.

-
The Cryptography Mailing List
Unsubscribe by sending unsubscribe cryptography to [EMAIL PROTECTED]