INNER CODE UNIT · C++
beta
ph4r05/Whitebox-crypto-AES · BGEAttack.cpp:278
GF2E beta = (coefs[a].gfCoef * coefs[b].gfCoef) * (coefs[c].gfCoefInv * coefs[d].gfCoefInv);
BYTE intBeta = (BYTE) getLong(beta);
if (doCout) cout << "i="<<i<<"; Beta=["<<CHEX(intBeta)
<<"]; a="<<CHEX(coefs[a].intCoef)
<<"; b="<<CHEX(coefs[b].intCoef)
<<"; c="<<CHEX(coefs[c].intCoef) << ", inv="<<CHEX(coefs[c].intCoefInv)
<<"; d="<<CHEX(coefs[d].intCoef) << ", inv="<<CHEX(coefs[d].intCoefInv)<<endl;
if (bset.count(intBeta)==0) bset.insert(intBeta);
}
}
} else {
// Now generate combinations, 4*4*4*4 possibilities, I want to avoid 4 nested for loops, so with just one
for(int i=0; i<GF256; i++){
int a = i & 0x3; // index
int b = (i >> 2) & 0x3;
int c = (i >> 4) & 0x3; // c is from same col as a, c is inverse
int d = (i >> 6) & 0x3; // d is from same col as b, d is inverse