MCPcopy Create free account
hub / github.com/bwapi/bwapi / innerHash

Function innerHash

bwapi/Util/Source/Util/Sha1.cpp:46–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44 }
45
46 void innerHash(unsigned int *result, unsigned int *w)
47 {
48 unsigned int save[5];
49 save[0]=result[0];
50 save[1]=result[1];
51 save[2]=result[2];
52 save[3]=result[3];
53 save[4]=result[4];
54
55 #define a result[0]
56 #define b result[1]
57 #define c result[2]
58 #define d result[3]
59 #define e result[4]
60
61 int j=0;
62 #define sha1macro(func,val) \
63 {const unsigned int t = rol(a, 5)+(func)+e+val+w[j]; \
64 e = d; d = c; \
65 c = rol(b, 30); \
66 b = a; a = t;}
67 while(j<16)
68 {
69 sha1macro((b&c)|(~b&d),0x5A827999)
70 j++;
71 }
72 while(j<20)
73 {
74 w[j] = rol((w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16]), 1);
75 sha1macro((b&c)|(~b&d),0x5A827999)
76 j++;
77 }
78 while(j<40)
79 {
80 w[j] = rol((w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16]), 1);
81 sha1macro(b^c^d,0x6ED9EBA1)
82 j++;
83 }
84 while(j<60)
85 {
86 w[j] = rol((w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16]), 1);
87 sha1macro((b&c)|(b&d)|(c&d),0x8F1BBCDC)
88 j++;
89 }
90 while(j<80)
91 {
92 w[j] = rol((w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16]), 1);
93 sha1macro(b^c^d,0xCA62C1D6)
94 j++;
95 }
96 #undef sha1macro
97 #undef a
98 #undef b
99 #undef c
100 #undef d
101 #undef e
102
103 result[0]+=save[0];

Callers 1

calcFunction · 0.85

Calls 1

rolFunction · 0.85

Tested by

no test coverage detected