plz描述这段代码 [英] plz describe this code

查看:96
本文介绍了plz描述这段代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
此代码作为keccak函数(sha-3)的一部分,我不明白该怎么做C [index(x-xOff)];请帮助我。

hi this code as part of keccak function(sha-3), I do not understand what to do the "C[index(x-xOff)];" plz help me.

template<class Lane>
void KeccakF::inverseTheta(vector<Lane>& A) const
{
    vector<Lane> C(5);
    for(unsigned int x=0; x<5; x++) {

        C[x] = A[index(x,0)];

        for(unsigned int y=1; y<5; y++){

            C[x] ^= A[index(x,y)];

        }

    }

    const LaneValue inversePositions64[5] = {

        0xDE26BC4D789AF134ULL,

        0x09AF135E26BC4D78ULL,

        0xEBC4D789AF135E26ULL,

        0x7135E26BC4D789AFULL,

        0xCD789AF135E26BC4ULL };

    vector<LaneValue> inversePositions(5, 0);
    for(unsigned int z=0; z<64; z+=laneSize)

        for(unsigned int x=0; x<5; x++)

            inversePositions[x] ^= inversePositions64[x] >> z;
    for(unsigned int z=0; z<laneSize; z++) {

        for(unsigned int xOff=0; xOff<5; xOff++)

           for(int x=0; x<5; x++)

               for(unsigned int y=0; y<5; y++)

                   if ((inversePositions[xOff] & 1) != 0)

                      A[index(x, y)] ^= C[index(x-xOff)];

        for(unsigned int xOff=0; xOff<5; xOff++) {

            ROL(C[xOff], 1);

            inversePositions[xOff] >>= 1;
        }
    }
}

推荐答案

不要在几个地方发布相同的东西 - 它重复工作并惹恼人们。



你在C ++论坛上得到了这个答案。
Do not post the same thing in several places - it duplicates work and annoys people.

You have this answered in the C++ forum.


这篇关于plz描述这段代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆