MCPcopy Index your code
hub / github.com/rclone/rclone / Hash

Method Hash

backend/memory/memory.go:580–589  ·  view source on GitHub ↗

Hash returns the hash of an object returning a lowercase hex string

(ctx context.Context, t hash.Type)

Source from the content-addressed store, hash-verified

578
579// Hash returns the hash of an object returning a lowercase hex string
580func (o *Object) Hash(ctx context.Context, t hash.Type) (string, error) {
581 if t != hashType {
582 return "", hash.ErrUnsupported
583 }
584 if o.od.hash == "" && !o.fs.opt.Discard {
585 sum := md5.Sum(o.od.data)
586 o.od.hash = hex.EncodeToString(sum[:])
587 }
588 return o.od.hash, nil
589}
590
591// Size returns the size of an object in bytes
592func (o *Object) Size() int64 {

Callers

nothing calls this directly

Calls 2

EncodeToStringMethod · 0.65
SumMethod · 0.45

Tested by

no test coverage detected