INNER CODE UNIT · C++
dIdxs
ph4r05/Whitebox-crypto-AES · BGEAttack.cpp:248
int dIdxs=0; // number of distincs indexes in one column in mixcol
struct coef_t coefs[4];
boost::unordered_map<BYTE, int> coefsMap; // simple map: index -> array of indexes
// Determine coefficients used in MixCol in current AES used, compute inverses
for(int i=0; i<4; i++){
GF2E gfCoef = aes.mixColMat[i][0];
BYTE curCoef = (BYTE) getLong(gfCoef);
if(coefsMap.count(curCoef)==0){
coefs[dIdxs].gfCoef = gfCoef;
coefs[dIdxs].intCoef = curCoef;
inv(coefs[dIdxs].gfCoefInv, gfCoef);
coefs[dIdxs].intCoefInv = (BYTE) getLong(coefs[dIdxs].gfCoefInv);
coefs[dIdxs].count=1;
coefsMap.insert(std::pair<BYTE,int>(curCoef, dIdxs++));
} else {
coefs[coefsMap[curCoef]].count++;
}