From 58252b8a40dcbd1e0377515f3c118309c0f7dcc4 Mon Sep 17 00:00:00 2001 From: Winston Lowe Date: Mon, 23 Mar 2026 10:14:30 -0700 Subject: [PATCH] fix: Correct return type of _manualAckHash and improve hash computation --- test/services/retry_and_protocol_test.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/services/retry_and_protocol_test.dart b/test/services/retry_and_protocol_test.dart index 48d4cfb..b6c53b6 100644 --- a/test/services/retry_and_protocol_test.dart +++ b/test/services/retry_and_protocol_test.dart @@ -14,7 +14,7 @@ import 'package:meshcore_open/services/message_retry_service.dart'; /// Replicates the SHA-256 computation from [MessageRetryService.computeExpectedAckHash] /// so tests can cross-check without calling the real implementation twice. -Uint8List _manualAckHash( +int _manualAckHash( int timestampSeconds, int attemptMasked, // already masked to 0x03 String text, @@ -35,7 +35,8 @@ Uint8List _manualAckHash( buffer.setRange(offset, offset + senderPubKey.length, senderPubKey); final hash = sha256.convert(buffer); - return Uint8List.fromList(hash.bytes.sublist(0, 4)); + final bytes = Uint8List.fromList(hash.bytes.sublist(0, 4)); + return (bytes[3] << 24) | (bytes[2] << 16) | (bytes[1] << 8) | bytes[0]; } Uint8List _makeKey(int seed) {