def galois_multiply(a, b):
 p = 0
 while b:
  if (b & 1):
   p ^= a
  a <<= 1
  if (a & 256):
   a ^= 27
  b >>= 1
 return (p & 255)

def galois_multiply ( a , b ) : p = 0 while b : if ( b & 1 ) : p ^= a a <<= 1 if ( a & 256 ) : a ^= 27 b >>= 1 return ( p & 255 )
galois field multiplicaiton for aes .