Commit 560cad59 authored by Белов Никита Сергеевич's avatar Белов Никита Сергеевич
Browse files

Update ak_belt_hash.c

parent f4b80e29
No related merge requests found
Showing with 5 additions and 5 deletions
+5 -5
...@@ -101,7 +101,7 @@ static int ak_hash_context_belt_update(ak_pointer sctx, const ak_pointer in, con ...@@ -101,7 +101,7 @@ static int ak_hash_context_belt_update(ak_pointer sctx, const ak_pointer in, con
memcpy(compress_in, dt, 32); // Загружаем данные для функции сжатия memcpy(compress_in, dt, 32); // Загружаем данные для функции сжатия
memcpy(compress_in + 4, cx->h, 32); memcpy(compress_in + 4, cx->h, 32);
ak_belt_compress(compress_out, compress_in, &(cx->bcctx)); // Сжимаем данные ak_belt_compress(compress_out, compress_in, cx->bcctx); // Сжимаем данные
memcpy(cx->h, compress_out + 2, 32); // Обновляем h memcpy(cx->h, compress_out + 2, 32); // Обновляем h
...@@ -127,9 +127,9 @@ static int ak_hash_context_belt_finalize(ak_pointer sctx, ...@@ -127,9 +127,9 @@ static int ak_hash_context_belt_finalize(ak_pointer sctx,
if (out_size < 32) return ak_error_message(ak_error_wrong_length, __func__, if (out_size < 32) return ak_error_message(ak_error_wrong_length, __func__,
"output length is too small"); "output length is too small");
ak_uint8* din = (ak_uint8*)in;
size_t ssize = size; size_t ssize = size&31;
ak_uint8* din = ((ak_uint8*)in)+size-ssize;
ak_uint64 lastBlock[8]; ak_uint64 lastBlock[8];
ak_hash_context_belt_update(sctx, in, (size /32)*32); ak_hash_context_belt_update(sctx, in, (size /32)*32);
...@@ -153,7 +153,7 @@ static int ak_hash_context_belt_finalize(ak_pointer sctx, ...@@ -153,7 +153,7 @@ static int ak_hash_context_belt_finalize(ak_pointer sctx,
memcpy(lastBlock + 4, cx->h, 32); memcpy(lastBlock + 4, cx->h, 32);
ak_uint64 final[6]; ak_uint64 final[6];
ak_belt_compress(final, lastBlock, &(cx->bcctx)); ak_belt_compress(final, lastBlock, cx->bcctx);
memcpy(out, final + 2, 32); memcpy(out, final + 2, 32);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment