Closed leiless closed 2 years ago
But I don't how to roll a single byte out of the window array.
The function rolling_hash2_run() does this automatically. It rolls in each byte at the beginning of the window and rolls out each byte at the end of the window while also checking (hash & mask) == trigger
. You could do one byte at a time by setting the max_len = 1 but it is more efficient to run for longer stretches.
It rolls in each byte at the beginning of the window and rolls out each byte at the end of the window while also checking (hash & mask) == trigger.
rolling_hash2_run()
seems do roll out and roll in at the same time even if max_len = 1
, i.e. rotate.
But I need only to roll out a single byte out the leftmost of the sliding window.
It rolls in each byte at the beginning of the window and rolls out each byte at the end of the window while also checking (hash & mask) == trigger.
rolling_hash2_run()
seems do roll out and roll in at the same time even ifmax_len = 1
, i.e. rotate. But I need only to roll out a single byte out the leftmost of the sliding window.
Hi, sorry to bother you @gbtucker, any update on this?
It rolls in each byte at the beginning of the window and rolls out each byte at the end of the window while also checking (hash & mask) == trigger.
rolling_hash2_run()
seems do roll out and roll in at the same time even ifmax_len = 1
, i.e. rotate. But I need only to roll out a single byte out the leftmost of the sliding window.
No, sorry but the three operations (add new contribution, subtract contribution from end of window, and check trigger) are together in one call so you cannot just do one of the three within this API.
Okay, thanks for your reply.
Hi, @gbtucker.
How can I roll a single byte out via
rolling_hash2_run()
? it is possible? (since it's a cryptographic rolling hash)My goal is to replace the Adler-32 rolling checksum algorithm with the ISAL crypto rolling hash. I can implement
update()
simply by makingmask = 1, trigger = 0
, sincehash | mask = hash | 1 = 0
is always false, so the whole buffer was calculated, so I can utilize the 64-bithash
value.And roll a single byte in can apply the same manner aforementioned.
(P.S. roll-in = add, roll-out = remove)
But I don't how to roll a single byte out of the window array.
I want to do something that is similar to
https://github.com/Shakeskeyboarde/adler32#examples
With current
rolling_hash2_run()
implementation, I can only roll-in bytes, but I cannot do something likeadler32.roll(sum, 5, the_removed_byte)
to kick a single byte out.