Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. describe this code

describe this code

Scheduled Pinned Locked Moved Managed C++/CLI
databasegraphicshelpquestion
3 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mostafaghanei
    wrote on last edited by
    #1

    hi this code is a part of keecak function. i do not undrastand what is "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++) {

    = A[index(x,0)];

    for(unsigned int y=1; y<5; y++){
    ^= 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++)
    ^= 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;
    }
    }
    }

    L M 2 Replies Last reply
    0
    • M mostafaghanei

      hi this code is a part of keecak function. i do not undrastand what is "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++) {

      = A[index(x,0)];

      for(unsigned int y=1; y<5; y++){
      ^= 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++)
      ^= 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;
      }
      }
      }

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      index() is a function that takes two values and returns another value. You need to find the documentation for it to know what all the values represent.

      1 Reply Last reply
      0
      • M mostafaghanei

        hi this code is a part of keecak function. i do not undrastand what is "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++) {

        = A[index(x,0)];

        for(unsigned int y=1; y<5; y++){
        ^= 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++)
        ^= 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;
        }
        }
        }

        M Offline
        M Offline
        Munchies_Matt
        wrote on last edited by
        #3

        mostafaghanei wrote:

        this code is a part of keecak function

        Ahh, Keecak eh? Yes, that's very well known. I am sure someone can tell you what it does.

        "The whole idea that carbon dioxide is the main cause of the recent global warming is based on a guess that was proved false by empirical evidence during the 1990s." climate-models-go-cold

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups