INNER CODE UNIT · C++
c
ph4r05/Whitebox-crypto-AES · BGEAttack.cpp:294
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
if (a>=dIdxs || b>=dIdxs || c>=dIdxs || d>=dIdxs) continue; // in case there are some coefs with count>1
if (a==c && coefs[a].count==1) continue; // they are from same col, can have same value only if count is bigger than 1
if (b==d && coefs[b].count==1) continue; // they are from same col, can have same value only if count is bigger than 1
if (a==d && coefs[a].count==1) continue; // they are from same row, can have same value only if count is bigger than 1
if (b==c && coefs[b].count==1) continue; // they are from same row, can have same value only if count is bigger than 1
if (a==d && b==c) continue; // not 2 rows same
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);
}