Skip to content

Commit ec06db4

Browse files
committed
update
1 parent 9d75b54 commit ec06db4

File tree

3 files changed

+2054
-2
lines changed

3 files changed

+2054
-2
lines changed

c_src/main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
void sha256(void *input_data, uint32_t digest[8], uint32_t num_blks);
1111
int main(int argc, char *argv[]) {
12-
uint32_t ostate[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
12+
static const uint32_t ostate[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
1313
uint32_t state[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
1414
uint8_t block[32] = "AnatolyYakovenko11/2/201712pmPST";
1515
uint32_t *blkptr = (void*)block;
@@ -28,7 +28,6 @@ int main(int argc, char *argv[]) {
2828
printf(" %04x%04x%04x%04x\n", state[4], state[5], state[6], state[7]);
2929
assert(!gettimeofday(&start, 0));
3030
for(i; ;++i) {
31-
sha256(block, state, 1);
3231
if(__builtin_expect((i & 0xfffff) == 0, 1)) {
3332
double total;
3433
uint64_t ix = i >> 20;
@@ -42,6 +41,7 @@ int main(int argc, char *argv[]) {
4241
printf(" %04x%04x%04x%04x\n", blkptr[4], blkptr[5], blkptr[6], blkptr[7]);
4342
printf("speed %lu %G %G\n", i, total, i/total);
4443
}
44+
sha256(block, state, 1);
4545
blkptr[0] = state[0];
4646
blkptr[1] = state[1];
4747
blkptr[2] = state[2];

0 commit comments

Comments
 (0)