MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / encrypt

Function encrypt

driver/ipfs-synckv/singularity.go:26–37  ·  view source on GitHub ↗
(data []byte, key []byte)

Source from the content-addressed store, hash-verified

24 }
25 nonce := make([]byte, gcm.NonceSize())
26 if _, err := rand.Read(nonce); err != nil {
27 return nil, err
28 }
29 return gcm.Seal(nonce, nonce, data, nil), nil
30}
31
32func decrypt(data []byte, key []byte) ([]byte, error) {
33 gcm, err := newGCM(key)
34 if err != nil {
35 return nil, err
36 }
37 nonceSize := gcm.NonceSize()
38 if len(data) < nonceSize {
39 return nil, errCiphertextTooShort
40 }

Callers 2

PutMethod · 0.70
PutMethod · 0.70

Calls 2

ErrorMethod · 0.45

Tested by

no test coverage detected