Take the 2-minute tour ×

I'm having one doubt about the VIM ENCRYPTION key.

I having a text file, I encrypted that file using


Now, where the encrypted key is stored (path).

Whether it stored in a separate file or the text file itself.

If I open a the file it asked Encryption key.

How it compare my key with the original key?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

It doesn't store the key - it just encrypts or decrypts with the key you type.

Here's a hex dump of a 15-character file encrypted with a key ('elephant' - try it; the contents was not meaningful ('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.

It's 27 characters long; 'VimCrypt~01!' is 12 characters. If you decrypt it with the wrong key (say 'pinkpanther'), you get garbage. So, vim does no integrity checking on the encrypted file or decrypted file.

share|improve this answer
add comment

The key is not saved, you have to enter it by yourself. It wouldn't make any sense to save the key as well, because everyone can decrypt the file with the stored key. If you open the file in vim again it ask for the encryption key.

share|improve this answer
add comment

Your Answer


