Chunker內(nèi)容定義組塊實(shí)現(xiàn)
Chunker 是基于滾動(dòng) Rabin Hash 實(shí)現(xiàn)內(nèi)容定義組塊(CDC)。
CDC 算法是一種變長(zhǎng)分塊算法,它應(yīng)用數(shù)據(jù)指紋(如Rabin指紋)將文件分割成長(zhǎng)度大小不等的分塊策略。與定長(zhǎng)分塊算法不同,它是基于文件內(nèi)容進(jìn)行數(shù)據(jù)塊切分的,因此數(shù)據(jù)塊大小是可變化的。
package chunker
import "github.com/restic/chunker"
對(duì)于以十六進(jìn)制系數(shù)表示法對(duì)指定的多項(xiàng)式列表進(jìn)行過濾,可以使用以下腳本:
# create x over F_2 = GF(2) x := Indeterminate(GF(2), "x"); # test if polynomial is irreducible, i.e. the number of factors is one IrredPoly := function (poly) return (Length(Factors(poly)) = 1); end;; # create a polynomial in x from the hexadecimal representation of the # coefficients Hex2Poly := function (s) return ValuePol(CoefficientsQadic(IntHexString(s), 2), x); end;; # list of candidates, in hex candidates := [ "3DA3358B4DC173" ]; # create real polynomials L := List(candidates, Hex2Poly); # filter and display the list of irreducible polynomials contained in L Display(Filtered(L, x -> (IrredPoly(x))));
評(píng)論
圖片
表情
