]> git.codecow.com Git - nano25519.git/commitdiff
Compute offset instead of relying on magic number.
authorChris Duncan <chris@codecow.com>
Fri, 25 Sep 2026 17:19:32 +0000 (10:19 -0700)
committerChris Duncan <chris@codecow.com>
Fri, 25 Sep 2026 17:19:32 +0000 (10:19 -0700)
src/lib/verify.ts

index 1307276d099d89bdba387f9947ef4acce2cb36f9..983cbb4aac399b46368c4f9e6367cee85fe92097 100644 (file)
@@ -51,7 +51,7 @@ export function verify_blocks (pub: unknown, data: unknown): boolean[] {
                        }
                        const signature = normalize('signature', SIGNATURE_BYTELENGTH, SIGNATURE_BYTELENGTH, block.signature)
                        const hash = normalize('hash', BLOCKHASH_BYTELENGTH, BLOCKHASH_BYTELENGTH, block.hash)
-                       const offset = b * 96
+                       const offset = b * (SIGNATURE_BYTELENGTH + BLOCKHASH_BYTELENGTH)
                        message.set(signature, offset)
                        message.set(hash, offset + SIGNATURE_BYTELENGTH)
                }