fd0 / rabin-cdc

Fast implementation of Content Defined Chunking (CDC) based on a rolling Rabin Checksum in C.
BSD 2-Clause "Simplified" License
48 stars 16 forks source link

Polynomial generator #2

Open GamePad64 opened 8 years ago

GamePad64 commented 8 years ago

Hello, You have mentioned in #1, that you have a polynomial generator in https://github.com/restic/chunker, written in Go. Is there any way to port it to C?

fd0 commented 8 years ago

Sure, that should be straight-forward. The code is here: https://github.com/restic/chunker/blob/master/polynomials.go

A Pol is an alias for an uint64.

I have a few test polynomials that may be helpful while porting: https://github.com/restic/chunker/blob/master/polynomials_test.go#L240-L268

fd0 commented 8 years ago

What are you planning to do with the generator?

GamePad64 commented 8 years ago

I am writing a file synchronization application. For each file, some sort of "metafile" is created. I will generate a new polynomial for each file, encrypt it with AES key and transfer to another node inside a metafile. As the blocks are supposed to be AES encrypted, then I will have to generate a new polynomial because of the fingerprinting attack.