コード例 #1
0
ファイル: sha_test.py プロジェクト: 4lextg/kabopan
 def rounds(self, words):
     [a, b, c, d, e] = list(self.ihvs)
     for round_ in range(4):
         f = Sha_u.functions[round_]
         k = Sha_u.constants[round_]
         ranges = [20, 20, 20, 10][round_]
         for i in range(ranges):
             [a, b, c, d, e] = Sha_u.round_f(a, b, c, d, e, f, 5, 30, words, i + 20 * round_, k)
     return [a, b, c, d, e]
コード例 #2
0
 def rounds(self, words):
     [a, b, c, d, e] = list(self.ihvs)
     for round_ in range(4):
         f = Sha_u.functions[round_]
         k = Sha_u.constants[round_]
         ranges = [20, 20, 20, 10][round_]
         for i in range(ranges):
             [a, b, c, d, e] = Sha_u.round_f(a, b, c, d, e, f, 5, 30, words,
                                             i + 20 * round_, k)
     return [a, b, c, d, e]
コード例 #3
0
ファイル: has.py プロジェクト: 4lextg/kabopan
    def rounds(self, words):
        words.extend((0 for i in xrange(20-16)))
        a, b, c, d, e = list(self.ihvs)
        for r in range(4):
            f = [Md4_u.f, Md4_u.h, Md5_u.i, Md4_u.h][r]
            k = Has160_u.constants[r]
            b_rot = [10, 17, 25, 30][r]

            for i in range(4):
                w = Qword(0)
                for j in xrange(4):
                    w ^= words[Has160_u.extensions[r][i][j]]
                words[16 + i] = w

            for i in range(20):
                index = Has160_u.indexes[r][i]
                a_rot = [5, 11, 7, 15, 6, 13, 8, 14, 7, 12, 9, 11, 8, 15, 6, 12, 9, 14, 5, 13][i]

                a, b, c, d, e = Sha_u.round_f(a, b, c, d, e, f, a_rot, b_rot, words, index, k)
        return [a, b, c, d, e]
コード例 #4
0
    def rounds(self, words):
        words.extend((0 for i in xrange(20 - 16)))
        a, b, c, d, e = list(self.ihvs)
        for r in range(4):
            f = [Md4_u.f, Md4_u.h, Md5_u.i, Md4_u.h][r]
            k = Has160_u.constants[r]
            b_rot = [10, 17, 25, 30][r]

            for i in range(4):
                w = Qword(0)
                for j in xrange(4):
                    w ^= words[Has160_u.extensions[r][i][j]]
                words[16 + i] = w

            for i in range(20):
                index = Has160_u.indexes[r][i]
                a_rot = [
                    5, 11, 7, 15, 6, 13, 8, 14, 7, 12, 9, 11, 8, 15, 6, 12, 9,
                    14, 5, 13
                ][i]

                a, b, c, d, e = Sha_u.round_f(a, b, c, d, e, f, a_rot, b_rot,
                                              words, index, k)
        return [a, b, c, d, e]