Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VIM: Encryption key

Tags:

vim

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

I having a text file, I encrypted that file using

:X

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?

like image 632
ungalnanban Avatar asked Apr 15 '10 07:04

ungalnanban


1 Answers

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.
0x001B:

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.

like image 82
Jonathan Leffler Avatar answered Sep 22 '22 23:09

Jonathan Leffler