MCPcopy Create free account
hub / github.com/devspace-sh/devspace / PadKey

Function PadKey

pkg/util/encryption/util.go:13–26  ·  view source on GitHub ↗

PadKey formats the key to the correct padding (32 byte)

(key []byte)

Source from the content-addressed store, hash-verified

11
12// PadKey formats the key to the correct padding (32 byte)
13func PadKey(key []byte) []byte {
14 if len(key) == 32 {
15 return key
16 } else if len(key) > 32 {
17 return key[:32]
18 }
19
20 // Append to key this wont change the key
21 for len(key) < 32 {
22 key = append(key, ' ')
23 }
24
25 return key
26}
27
28// EncryptAES encrypts the given data with the given key
29func EncryptAES(key, data []byte) ([]byte, error) {

Callers 3

TestPadKeyFunction · 0.85
EncryptAESFunction · 0.85
DecryptAESFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestPadKeyFunction · 0.68