From 6e19c627ec81fc41780111d5e40a3fa858e55803 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Tue, 25 Mar 2025 10:26:41 +0800 Subject: Indent -linux --- wasm/solver.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'wasm/solver.c') diff --git a/wasm/solver.c b/wasm/solver.c index eb8647b..890a34c 100644 --- a/wasm/solver.c +++ b/wasm/solver.c @@ -6,7 +6,8 @@ unsigned char challenge[32]; -char validate_hash(unsigned char *hash, unsigned char zero_bit_count) { +char validate_hash(unsigned char *hash, unsigned char zero_bit_count) +{ unsigned char q = zero_bit_count / 8; unsigned char r = zero_bit_count % 8; @@ -25,11 +26,13 @@ char validate_hash(unsigned char *hash, unsigned char zero_bit_count) { return 1; } -unsigned char *get_challenge_ptr() { +unsigned char *get_challenge_ptr() +{ return challenge; } -unsigned long long solve(unsigned char difficulty) { +unsigned long long solve(unsigned char difficulty) +{ unsigned long long nonce; SHA256_CTX context; @@ -37,13 +40,14 @@ unsigned long long solve(unsigned char difficulty) { nonce = 0; - while(1) { + while (1) { sha256_init(&context); sha256_update(&context, challenge, sizeof(challenge)); - sha256_update(&context, (unsigned char*)(&nonce), sizeof(nonce)); + sha256_update(&context, (unsigned char *)(&nonce), + sizeof(nonce)); sha256_final(&context, hash); - if(validate_hash(hash, difficulty)) { + if (validate_hash(hash, difficulty)) { break; } -- cgit v1.2.3