MCPcopy Create free account
hub / github.com/AbelChe/evil_minio / DerivePartKey

Method DerivePartKey

internal/crypto/key.go:139–147  ·  view source on GitHub ↗

DerivePartKey derives an unique 256 bit key from an ObjectKey and the part index.

(id uint32)

Source from the content-addressed store, hash-verified

137
138// DerivePartKey derives an unique 256 bit key from an ObjectKey and the part index.
139func (key ObjectKey) DerivePartKey(id uint32) (partKey [32]byte) {
140 var bin [4]byte
141 binary.LittleEndian.PutUint32(bin[:], id)
142
143 mac := hmac.New(sha256.New, key[:])
144 mac.Write(bin[:])
145 mac.Sum(partKey[:0])
146 return partKey
147}
148
149// SealETag seals the etag using the object key.
150// It does not encrypt empty ETags because such ETags indicate

Callers 5

TestDerivePartKeyFunction · 0.95
CopyObjectPartHandlerMethod · 0.95
PutObjectPartHandlerMethod · 0.95
EncryptMultiPartFunction · 0.80

Calls 2

NewMethod · 0.80
WriteMethod · 0.45

Tested by 1

TestDerivePartKeyFunction · 0.76