public Chunker(Stream stream, HasherType type, uint significantHashBits) { //significantBitsMask = (uint)Math.Pow(2, significantHashBits); for (var i = 0; i < significantHashBits; i++) { significantBitsMask = (uint)((significantBitsMask << 1) + 1); } copyingStream = new CopyingStream(stream); this.hasher = AbstractRollingHasher.createInstance(type, copyingStream, WINDOW_SIZE); }
public static AbstractRollingHasher createInstance(HasherType type, Stream stream, int windowSize) { switch (type) { case HasherType.BuzHash: return(new BuzHashRollingHasher(stream, windowSize)); default: return(null); } }
public IHasher CreateHasher(HasherType hasherType) { switch (hasherType) { case HasherType.None: return(new NotHasher()); case HasherType.MD5: return(new MDFive128BitHasher()); case HasherType.SHA1: return(new Sha160BitHasher()); case HasherType.SHA256: return(new Sha256BitHasher()); case HasherType.SHA512: return(new Sha512BitHasher()); default: throw new ArgumentOutOfRangeException($"Unable to create IHasher for HasherType: '{hasherType}'"); } }
public Hasher(HasherType typ) { hasherType = typ; }
public Chunker(byte[] data, HasherType type, uint significantHashBits) : this(new MemoryStream(data), type, significantHashBits) { }
public Chunker(Stream stream, HasherType type) : this(stream, type, DEFAULT_SIGNIFICANT_BITS_NUMBER) { }
public Chunker(byte[] data, HasherType type) : this(new MemoryStream(data), type, DEFAULT_SIGNIFICANT_BITS_NUMBER) { }
public Hasher(HasherType typ) { hasherType = typ; }