fixes pseudo code

This commit is contained in:
Vitor Pamplona 2024-09-13 13:10:20 -04:00
parent e71e3907a7
commit 92d8bccc3e

6
76.md
View File

@ -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
}