Results 1 to 2 of 2
  1. #1
    christopherx is offline Member
    Join Date
    Oct 2011
    Posts
    92
    Rep Power
    0

    Default Galois Multiplication

    Righto! I've been writing my implementation of the Rijndal cipher, and I've got stuck on one particular part. the "mixColumns()" method to be exact. Basically,
    at first i was using lookup tables from wikipedia. Then I was having problems with the values my implementation was churning out. Anyhow, after some headache I wrote a function that multiplies over Rijndael's finite field, GF(2^8), and implemented it. Then to test it, I compared it to a step by step guide that I found here. Now I'm having a bit of an issue. The lookup tables, and my function for multiplying in GF(2^8) are churning out the same numbers, and the guide is showing me something different. Basically, according to the guide:

    d4 * 02 = 04 in Rijndael's finite field, however to the lookup table and my function, it's b3. I'm assuming the guide is right, it's from the cs website, so it's a credible source. I just want to know what I'm doing wrong.

    Java Code:
    private int galoisMultiply(int a, int b) {
    		
    		   int p = 0;
    		   
    		   for (int n=0; n<8; n++) {
    			   
    		      p = ((b & 0x01) > 0) ? p^a : p;
    		      
    		      boolean ho = ((a & 0x80) > 0);
    		      
    		      a = ((a<<1) & 0xFE);
    		      
    		      if (ho)
    		         a = a ^ 0x1b;
    		      
    		      b = ((b>>1) & 0x7F);
    		   }
    		   return p;
    		}
    Above is my multiplication function. I reckon that works fine, and that is returning b3 for my values as well, same with my lookup table, which can be found here. In this case, it's the table for multiplying by 2.

    I need either someone to talk me through Galois Multiplication, or perhaps someone can help me by looking at the tables and vouching for their credibility. Seriously am stuck for ideas at the moment and I would really love it if you guys could help me out here!

  2. #2
    christopherx is offline Member
    Join Date
    Oct 2011
    Posts
    92
    Rep Power
    0

    Default Re: Galois Multiplication

    Solved it. I was performing galois multiplication, just didn't take into account that it was matrix multiplication :)

Similar Threads

  1. need help with multiplication
    By dakid2 in forum New To Java
    Replies: 10
    Last Post: 03-08-2011, 04:41 AM
  2. Multiplication code
    By bomboy in forum Eclipse
    Replies: 2
    Last Post: 12-28-2010, 02:11 PM
  3. Multiplication Table
    By BillyB in forum New To Java
    Replies: 17
    Last Post: 12-24-2010, 07:58 AM
  4. need help with this: multiplication table
    By MsIceCold in forum New To Java
    Replies: 7
    Last Post: 07-13-2010, 02:31 PM
  5. Help with Multiplication
    By phil028 in forum New To Java
    Replies: 1
    Last Post: 12-06-2007, 08:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •