VIM: encryption key

I have one doubt about the VIM ENCRYPTION key.

I have a text file, I encrypted this file using

: X

Now that the encrypted key is saved (path).

Whether it is saved in a separate file or in the text file itself.

If I open the file, it will ask for the encryption key.

How does he compare my key with the original key?

+7
vim
source share
2 answers

It does not store the key - it simply encrypts or decrypts the key that you enter.

Here's the hex dump of the 15-character file encrypted with the key ("elephant" - try it, the content didn’t make sense ("abcdededesdasd") before I encrypted it):

0x0000: 56 69 6D 43 72 79 70 74 7E 30 31 21 95 96 C7 F6 VimCrypt~01!.... 0x0010: 75 C8 3B BF 1D BD BD 86 97 32 DA u.;......2. 0x001B: 

Length 27 characters; 'VimCrypt ~ 01! is 12 characters. If you decrypt it using the wrong key (say, "pink traveler"), you will get garbage. Thus, vim does not check integrity in an encrypted file or a decrypted file.

+2
source share

The key is not saved, you need to enter it yourself. It would also not make sense to save the key, because everyone can decrypt the file using the saved key. If you open the file in vim again, ask for the encryption key.

+1
source share

All Articles