MCPcopy
hub / github.com/syncthing/syncthing / decryptName

Function decryptName

lib/protocol/encryption.go:436–451  ·  view source on GitHub ↗

decryptName decrypts a string from encryptName

(name string, key *[keySize]byte)

Source from the content-addressed store, hash-verified

434
435// decryptName decrypts a string from encryptName
436func decryptName(name string, key *[keySize]byte) (string, error) {
437 name, err := deslashify(name)
438 if err != nil {
439 return "", err
440 }
441 bs, err := base32Hex.DecodeString(name)
442 if err != nil {
443 return "", err
444 }
445 dec, err := decryptDeterministic(bs, key, nil)
446 if err != nil {
447 return "", err
448 }
449
450 return string(dec), nil
451}
452
453// encryptBytes encrypts bytes with a random nonce
454func encryptBytes(data []byte, key *[keySize]byte) []byte {

Callers 4

TestEnDecryptNameFunction · 0.85
TestDecryptNameInvalidFunction · 0.85
RequestMethod · 0.85
DecryptFileInfoFunction · 0.85

Calls 2

deslashifyFunction · 0.85
decryptDeterministicFunction · 0.85

Tested by 2

TestEnDecryptNameFunction · 0.68
TestDecryptNameInvalidFunction · 0.68