mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-22 08:25:53 -05:00
Fixes the pseudo code
This commit is contained in:
parent
3c7429b665
commit
36f9a2e58f
6
76.md
6
76.md
|
@ -61,11 +61,13 @@ class BloomFilter(size: Int, rounds: Int, buffer: ByteArray) {
|
|||
return true
|
||||
}
|
||||
|
||||
fun encode() = size + ":" + rounds + ":" + base64Enc(bits.toByteArray()) // base64 might include extra 0 bits to fill the last byte
|
||||
fun encode() {
|
||||
return size + ":" + rounds + ":" + base64Encode(bits.toByteArray())
|
||||
}
|
||||
|
||||
fun decode(str: String): BloomFilter {
|
||||
val parts = str.split(":")
|
||||
return BloomFilter(parts[0].toInt(), parts[1].toInt(), base64Decode(bits.toByteArray()))
|
||||
return BloomFilter(parts[0].toInt(), parts[1].toInt(), base64Decode(parts[2]))
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue
Block a user