Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for NewChecker (0.22 sec)

  1. internal/hash/checker.go

    // Checker allows to verify the checksum of a reader.
    type Checker struct {
    	c io.Closer
    	r io.Reader
    	h hash.Hash
    
    	want []byte
    }
    
    // NewChecker ensures that content with the specified length is read from rc.
    // Calling Close on this will close upstream.
    func NewChecker(rc io.ReadCloser, h hash.Hash, wantSum []byte, length int64) *Checker {
    	return &Checker{c: rc, r: ioutil.HardLimitReader(rc, length), h: h, want: wantSum}
    }
    
    Registered: Sun Dec 28 19:28:13 UTC 2025
    - Last Modified: Mon Jan 20 14:49:07 UTC 2025
    - 1.8K bytes
    - Viewed (0)
  2. cmd/utils.go

    		if err != nil {
    			return false
    		}
    		r.Body = hash.NewChecker(r.Body, md5.New(), want, r.ContentLength)
    		return true
    	}
    	cs, err := hash.GetContentChecksum(r.Header)
    	if err != nil {
    		return false
    	}
    	if cs == nil || !cs.Type.IsSet() {
    		return false
    	}
    	if cs.Valid() && !cs.Type.Trailing() {
    		r.Body = hash.NewChecker(r.Body, cs.Type.Hasher(), cs.Raw, r.ContentLength)
    	}
    	return true
    }
    Registered: Sun Dec 28 19:28:13 UTC 2025
    - Last Modified: Sun Sep 28 20:59:21 UTC 2025
    - 33K bytes
    - Viewed (0)
Back to top