Photo

Algorithmic Cryptanalysis

External Links

  • Libraries & Programs
  • Readings
  • IACR
  • Cryptographer's world
  • CRC Press
  • Book on CRC Press
  • Author's home page
  • Other Links
Wed Dec 4 21:56:37 2024

Algorithmic Cryptanalysis (View it on amazon.com)

A CRC Press Book by Antoine Joux

Program 3.9: Matrix inversion of 32 X 32 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.
/* Warning: mat is transformed during MatInv */
int MatInv(WORD mat[DIM], WORD inv[DIM])
{

  int piv,l,c,k;
  WORD val,vali,mask;

  for(piv=0,mask=1;piv<DIM;piv++,mask<<=1)

    inv[piv]=mask;
  for(piv=0,mask=1;piv<DIM;piv++,mask<<=1) {

    for (c=piv;c<DIM;c++) if (mask&mat[c]) break;

    if (c>=DIM) return(FALSE);
    val=mat[c];mat[c]=mat[piv];mat[piv]=val;

    vali=inv[c];inv[c]=inv[piv];inv[piv]=vali;

    for(c=0;c<DIM;c++) if ((c!=piv)&&(mask&mat[c])) {

      mat[c]^=val;inv[c]^=vali; }}
  return(TRUE);
}

Credits for page styles: Dynamic Drive CSS Library