Merge branch 'master' into BCN_merge

This commit is contained in:
OracionSeis 2014-05-09 00:42:47 +04:00
commit e3cf75a7a5
2 changed files with 7 additions and 10 deletions

View file

@ -95,13 +95,12 @@ void cn_slow_hash(const void *data, size_t length, char *hash) {
memcpy(text, state.init, INIT_SIZE_BYTE); memcpy(text, state.init, INIT_SIZE_BYTE);
memcpy(aes_key, state.hs.b, AES_KEY_SIZE); memcpy(aes_key, state.hs.b, AES_KEY_SIZE);
aes_ctx = oaes_alloc(); aes_ctx = oaes_alloc();
for (i = 0; i < MEMORY / INIT_SIZE_BYTE; i++) {
for (j = 0; j < INIT_SIZE_BLK; j++) {
oaes_key_import_data(aes_ctx, aes_key, AES_KEY_SIZE); oaes_key_import_data(aes_ctx, aes_key, AES_KEY_SIZE);
for (i = 0; i < MEMORY / INIT_SIZE_BYTE; i++) {
for (j = 0; j < INIT_SIZE_BLK; j++)
oaes_pseudo_encrypt_ecb(aes_ctx, &text[AES_BLOCK_SIZE * j]); oaes_pseudo_encrypt_ecb(aes_ctx, &text[AES_BLOCK_SIZE * j]);
/*memcpy(aes_key, &text[AES_BLOCK_SIZE * j], AES_KEY_SIZE);*/
memcpy(aes_key, state.hs.b, AES_KEY_SIZE);
}
memcpy(&long_state[i * INIT_SIZE_BYTE], text, INIT_SIZE_BYTE); memcpy(&long_state[i * INIT_SIZE_BYTE], text, INIT_SIZE_BYTE);
} }
@ -137,17 +136,15 @@ void cn_slow_hash(const void *data, size_t length, char *hash) {
} }
memcpy(text, state.init, INIT_SIZE_BYTE); memcpy(text, state.init, INIT_SIZE_BYTE);
oaes_key_import_data(aes_ctx, &state.hs.b[32], AES_KEY_SIZE);
for (i = 0; i < MEMORY / INIT_SIZE_BYTE; i++) { for (i = 0; i < MEMORY / INIT_SIZE_BYTE; i++) {
for (j = 0; j < INIT_SIZE_BLK; j++) { for (j = 0; j < INIT_SIZE_BLK; j++) {
/*oaes_key_import_data(aes_ctx, &long_state[i * INIT_SIZE_BYTE + j * AES_BLOCK_SIZE], AES_KEY_SIZE);*/
oaes_key_import_data(aes_ctx, &state.hs.b[32], AES_KEY_SIZE);
xor_blocks(&text[j * AES_BLOCK_SIZE], &long_state[i * INIT_SIZE_BYTE + j * AES_BLOCK_SIZE]); xor_blocks(&text[j * AES_BLOCK_SIZE], &long_state[i * INIT_SIZE_BYTE + j * AES_BLOCK_SIZE]);
oaes_pseudo_encrypt_ecb(aes_ctx, &text[j * AES_BLOCK_SIZE]); oaes_pseudo_encrypt_ecb(aes_ctx, &text[j * AES_BLOCK_SIZE]);
} }
} }
memcpy(state.init, text, INIT_SIZE_BYTE); memcpy(state.init, text, INIT_SIZE_BYTE);
hash_permutation(&state.hs); hash_permutation(&state.hs);
/*memcpy(hash, &state, 32);*/
extra_hashes[state.hs.b[0] & 3](&state, 200, hash); extra_hashes[state.hs.b[0] & 3](&state, 200, hash);
oaes_free(&aes_ctx); oaes_free(&aes_ctx);
} }

View file

@ -80,7 +80,7 @@ namespace cryptonote
#endif #endif
block_reward += fee; block_reward += fee;
std::vector<size_t> out_amounts; std::vector<uint64_t> out_amounts;
decompose_amount_into_digits(block_reward, DEFAULT_FEE, decompose_amount_into_digits(block_reward, DEFAULT_FEE,
[&out_amounts](uint64_t a_chunk) { out_amounts.push_back(a_chunk); }, [&out_amounts](uint64_t a_chunk) { out_amounts.push_back(a_chunk); },
[&out_amounts](uint64_t a_dust) { out_amounts.push_back(a_dust); }); [&out_amounts](uint64_t a_dust) { out_amounts.push_back(a_dust); });
@ -92,7 +92,7 @@ namespace cryptonote
out_amounts.resize(out_amounts.size() - 1); out_amounts.resize(out_amounts.size() - 1);
} }
size_t summary_amounts = 0; uint64_t summary_amounts = 0;
for (size_t no = 0; no < out_amounts.size(); no++) for (size_t no = 0; no < out_amounts.size(); no++)
{ {
crypto::key_derivation derivation = AUTO_VAL_INIT(derivation);; crypto::key_derivation derivation = AUTO_VAL_INIT(derivation);;