Skip to content

Commit fb51508

Browse files
authored
Add files via upload
1 parent c519d2c commit fb51508

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

aes.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -539,20 +539,20 @@ return;
539539
// polynomial: x^8 + x^4 + x^3 + x + 1
540540
// binary: 00011011 || hex: 0x1b
541541
unsigned int gfMul(unsigned int a, unsigned int b){
542-
unsigned int r = 0; // result
543-
unsigned int hi_bit_set; // high bit (leftmost)
542+
unsigned int r = 0; // result
543+
unsigned int hi_bit_set; // high bit (leftmost)
544544
int i; // counter for the loop
545545

546-
for(i = 0; i < 8; i++) {
547-
if(b & 1)
546+
for(i = 0; i < 8; i++) {
547+
if(b & 1)
548548
r ^= a;
549-
hi_bit_set = (a & 0x80);
550-
a <<= 1;
549+
hi_bit_set = (a & 0x80);
550+
a <<= 1;
551551

552552
if(hi_bit_set)
553-
a ^= 0x1b; // x^8 + x^4 + x^3 + x + 1
554-
b >>= 1;
555-
}
553+
a ^= 0x1b; // x^8 + x^4 + x^3 + x + 1
554+
b >>= 1;
555+
}
556556

557557
// if result legnth is more than 8 bits
558558
if(r > 255 && r < 512)
@@ -612,14 +612,14 @@ return;
612612
* we decrypting the output of encryption
613613
*/
614614
void test(){
615-
unsigned int state[BLOCK_SIZE][BLOCK_SIZE] = { // state array - input
615+
unsigned int state[BLOCK_SIZE][BLOCK_SIZE] = { // input
616616
{ 0x54, 0x4f, 0x4e, 0x20 },
617617
{ 0x77, 0x6e, 0x69, 0x54 },
618618
{ 0x6f, 0x65, 0x6e, 0x77 },
619619
{ 0x20, 0x20, 0x65, 0x6f }
620620
};
621621

622-
unsigned int key[BLOCK_SIZE][BLOCK_SIZE] = { // encryption key
622+
unsigned int key[BLOCK_SIZE][BLOCK_SIZE] = { // encryption key
623623
{ 0x54, 0x73, 0x20, 0x67 },
624624
{ 0x68, 0x20, 0x4b, 0x20 },
625625
{ 0x61, 0x6d, 0x75, 0x46 },

0 commit comments

Comments
 (0)