diff --git a/76.md b/76.md index 408cb313..10f7cd4d 100644 --- a/76.md +++ b/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])) } } ```