diff --git a/source/ak_belt_hash.c b/source/ak_belt_hash.c
index 2e701a840d13d21530b1535f0cdc2b928378ccad..90930a5db6f2cebeabe46978f663b0f0d14d8378 100644
--- a/source/ak_belt_hash.c
+++ b/source/ak_belt_hash.c
@@ -138,7 +138,9 @@ static int ak_hash_context_belt_finalize(ak_pointer sctx,
     ak_uint64 lastBlock[8];
     ak_uint64 final[6];
 
-    if ((size & 31) || !size)
+    ak_uint64* r = (ak_uint64*)cx->r;
+
+    if ((size & 31) || (r[0] == 0 && r[1] == 0))
     {
         memset(lastBlock, 0, 64); // Заполняем последний блок
         memcpy(lastBlock, din, ssize);
@@ -147,7 +149,6 @@ static int ak_hash_context_belt_finalize(ak_pointer sctx,
     }
 
 
-    ak_uint64* r = (ak_uint64*)cx->r;
     r[0] += size << 3;
     if (r[0] == 0)
     r[1] += 1;