INNER CODE UNIT · C++

s0

7thSamurai/steganography · src/sha256.cpp:96

        std::uint32_t s0 = rotr(w[i-15],  7) ^ rotr(w[i-15], 18) ^ (w[i-15] >>  3);
        std::uint32_t s1 = rotr(w[i- 2], 17) ^ rotr(w[i- 2], 19) ^ (w[i- 2] >> 10);
        w[i] = w[i-16] + s0 + w[i-7] + s1;
    }

    std::uint32_t tv[8];
    std::copy(h, h+8, tv);

    for (int i = 0; i < 64; i++) {
        std::uint32_t S1 = rotr(tv[4], 6) ^ rotr(tv[4], 11) ^ rotr(tv[4], 25);
        std::uint32_t ch = (tv[4] & tv[5]) ^ ((~tv[4]) & tv[6]);
        std::uint32_t temp1 = tv[7] + S1 + ch + k[i] + w[i];
        std::uint32_t S0 = rotr(tv[0], 2) ^ rotr(tv[0], 13) ^ rotr(tv[0], 22);
        std::uint32_t maj = (tv[0] & tv[1]) ^ (tv[0] & tv[2]) ^ (tv[1] & tv[2]);
        std::uint32_t temp2 = S0 + maj;

        tv[7] = tv[6];
        tv[6] = tv[5];

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…