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

Function encrypt

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

Source from the content-addressed store, hash-verified

24}
25
26func encrypt(data []byte, key []byte) []byte {
27 block, _ := aes.NewCipher(key)
28 gcm, err := cipher.NewGCM(block)
29 if err != nil {
30 panic(err.Error())
31 }
32
33 nonce := UnixTimePrefixedRandomNonce(gcm.NonceSize())
34
35 cipherText := gcm.Seal(nonce, nonce, data, nil)
36 return cipherText
37}
38
39func decrypt(data []byte, key []byte) []byte {
40 block, err := aes.NewCipher(key)

Callers

nothing calls this directly

Calls 2

ErrorMethod · 0.45

Tested by

no test coverage detected