Chunker 内容定义组块实现 Chunker

blov2016-12-18 02:00:04 • 2102 次点击    
这是一个分享于 2016-12-18 02:00:04 的项目,其中的信息可能已经有所发展或是发生改变。

Chunker 是基于滚动 Rabin Hash 实现内容定义组块(CDC)。

CDC 算法是一种变长分块算法,它应用数据指纹(如Rabin指纹)将文件分割成长度大小不等的分块策略。与定长分块算法不同,它是基于文件内容进行数据块切分的,因此数据块大小是可变化的。

package chunker

import "github.com/restic/chunker"

对于以十六进制系数表示法对指定的多项式列表进行过滤,可以使用以下脚本:

# 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))));

Implementation of Content Defined Chunking (CDC) in GoRead More

Latest commit to the master branch on 10-1-2023
Download as zip
授权协议:
BSD
开发语言:
Google Go 查看源码»
操作系统:
跨平台
2102 次点击  ∙  1 赞  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传