mrhooray / crc-rs

Rust implementation of CRC(16, 32, 64) with support of various standards

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need a way to set value

agrover opened this issue · comments

I am trying to work with LVM metadata CRCs. Their crc calcs both use a nonstandard table, and also use an initial value of 0xf597a6cf instead of 0. I was able to work around this with a local copy of crc-rs and changing the value field in struct Digest to public, but wanted your thoughts on fixing it upstream.

for reference: https://git.fedorahosted.org/cgit/lvm2.git/tree/lib/misc/crc.c

custom table and initial value can be used via update function like

update(0xf597a6cf, &lvm_crc_table, bytes);

but yeah we could make more sugar like taking initial value when creating a digest

ah, ok, will use update() as described. opened PR #3 for added sugar as you mentioned. Closing this issue, thanks!