-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Lines 31 to 43 in 9e3c385
| export const createIsBoundary: CreateIsBoundary = ( | |
| average: number, | |
| level: number, | |
| ): IsBoundary => { | |
| const limit = Number(MAX_UINT32 / BigInt(average)); | |
| return ({ seq, key }: Tuple) => { | |
| const digest = sha256(encode([level, seq, key])); | |
| return ( | |
| new DataView(digest.buffer, digest.byteOffset, 4).getUint32(0) < limit | |
| ); | |
| }; | |
| }; |
The boundary function currently encodes each entry [level, seq, key] into CBOR to be hashed by sha256. The boundary function is called on any entry that is encoded or decoded so it's called constantly.
I'm going to try just converting the level and seq to bytes and then concatenating with the entry key, then hashing with sha256. Another option that might work is not using a hash function at all since the boundary test doesn't need to be secure.
Metadata
Metadata
Assignees
Labels
No labels