public OperationStatus ReadFrom( ReadOnlySpan <byte> span, SignatureOptions options, out BlockSignature <TRollingHashAlgorithm, TStrongHashAlgorithm> sig) { if (span.Length < Size(options)) { sig = default; return(OperationStatus.NeedMoreData); } var rollingHash = BinaryPrimitives.ReadInt32BigEndian(span); var strongHash = span.Slice(4, options.StrongHashLength); sig = new BlockSignature <TRollingHashAlgorithm, TStrongHashAlgorithm> (rollingHash, strongHash); return(OperationStatus.Done); }
public bool Equals(BlockSignature <TRollingHashAlgorithm, TStrongHashAlgorithm> other) { Debug.Assert(_blockMatcher == null || other._blockMatcher == null); if (_rollingHash != other._rollingHash) { return(false); } if (_blockMatcher != null) { return(StrongHashEquals(eager: other, lazy: this)); } else if (other._blockMatcher != null) { return(StrongHashEquals(eager: this, lazy: other)); } return(_eagerStrongHash0 == other._eagerStrongHash0 && _eagerStrongHash1 == other._eagerStrongHash1 && _eagerStrongHash2 == other._eagerStrongHash2 && _eagerStrongHash3 == other._eagerStrongHash3); }