MCPcopy
hub / github.com/rclone/rclone / newCipher

Function newCipher

backend/crypt/cipher.go:187–203  ·  view source on GitHub ↗

newCipher initialises the cipher. If salt is "" then it uses a built in salt val

(mode NameEncryptionMode, password, salt string, dirNameEncrypt bool, enc fileNameEncoding)

Source from the content-addressed store, hash-verified

185
186// newCipher initialises the cipher. If salt is "" then it uses a built in salt val
187func newCipher(mode NameEncryptionMode, password, salt string, dirNameEncrypt bool, enc fileNameEncoding) (*Cipher, error) {
188 c := &Cipher{
189 mode: mode,
190 fileNameEnc: enc,
191 cryptoRand: rand.Reader,
192 dirNameEncrypt: dirNameEncrypt,
193 encryptedSuffix: ".bin",
194 }
195 c.buffers.New = func() any {
196 return new([blockSize]byte)
197 }
198 err := c.Key(password, salt)
199 if err != nil {
200 return nil, err
201 }
202 return c, nil
203}
204
205// setEncryptedSuffix set suffix, or an empty string
206func (c *Cipher) setEncryptedSuffix(suffix string) {

Callers 15

newCipherForConfigFunction · 0.85
testEncryptSegmentFunction · 0.85
TestDecryptSegmentBase32Function · 0.85
TestDecryptSegmentBase64Function · 0.85
TestEncDecMatchesFunction · 0.85

Calls 1

KeyMethod · 0.95

Tested by 15

testEncryptSegmentFunction · 0.68
TestDecryptSegmentBase32Function · 0.68
TestDecryptSegmentBase64Function · 0.68
TestEncDecMatchesFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…