Photo

Algorithmic Cryptanalysis

External Links

  • Libraries & Programs
  • Readings
  • IACR
  • Cryptographer's world
  • CRC Press
  • Book on CRC Press
  • Author's home page
  • Other Links
Mon Dec 17 03:28:56 2018

Algorithmic Cryptanalysis (View it on amazon.com)

A CRC Press Book by Antoine Joux

Program 3.6: Elementary matrix multiplication for 32n X 32n Boolean matrices

Creative Commons License
Algorithmic cryptanalysis codes by Antoine Joux are licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
#include <stdio.h>
#include <stdlib.h>

#define WORD unsigned int

#define access(M,i,j,bsize) (&M[((i)*(bsize)*DIM)+((j)*DIM)])

/* External procedure for 32x32 boolean matrix multiplication */
extern void Mul(WORD res[DIM], WORD mat1[DIM], WORD mat2[DIM]);

void matmul(WORD * A, WORD * B, WORD *Res, int bsize) {

  int i,j,k,l;
  WORD tmp[DIM];

  
  for(i=0;i<DIM*bsize*bsize;i++) 
    Res[i]=0;

  for(i=0;i<bsize;i++) 
    for(j=0;j<bsize;j++) {

      for(k=0;k<bsize;k++) {
        Mul(tmp, access(A,i,k,bsize), access(B,k,j,bsize));

        for(l=0;l<DIM;l++) {
          access(Res,i,j,bsize)[l]^=tmp[l];
        }
      }
    }
}

Credits for page styles: Dynamic Drive CSS Library