From 92d8bccc3e93283b3095ef39060ff7db7d35a154 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Fri, 13 Sep 2024 13:10:20 -0400 Subject: [PATCH] fixes pseudo code --- 76.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/76.md b/76.md index 141f82c6..3b884714 100644 --- a/76.md +++ b/76.md @@ -34,7 +34,7 @@ Probabilistic permissions use bloom filters that include a set of pubkeys. They Bloom filters MUST use `SHA-256` functions of the key + iterating index as the psedocode below: ```js -class BloomFilter(size: Int, n: Int, buffer: ByteArray) { +class BloomFilter(size: Int, rounds: Int, buffer: ByteArray) { val bits = BitArray(buffer) fun bitIndex(value: ByteArray, index: Byte) { @@ -44,7 +44,7 @@ class BloomFilter(size: Int, n: Int, buffer: ByteArray) { fun add(pubkey: HexKey) { val value = pubkey.hexToByteArray() - for (index in 0..n) { + for (index in 0 until rounds) { bits[bitIndex(value, index)] = true } } @@ -52,7 +52,7 @@ class BloomFilter(size: Int, n: Int, buffer: ByteArray) { fun mightContains(pubkey: HexKey): Boolean { val value = pubkey.hexToByteArray() - for (index in 0..n) { + for (index in 0 until rounds) { if (!bits[bitIndex(value, index)]) { return false }