Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Actually , i have encrypted file using vim -X option . Unfortunately i forget the encryption key. Is there any way to get back file without any data corruption .without knowing key.

Thanks.

share|improve this question

migrated from stackoverflow.com Feb 5 '11 at 6:08

This question came from our site for professional and enthusiast programmers.

1  
I think you're out of luck. There should be no way to recover the text in a reasonable amount of time without the key. –  Michael Anderson Feb 5 '11 at 4:42

4 Answers 4

No, of course not. It wouldn't be very good encryption if there were a backdoor that let you get the plaintext without the key.

There's always brute-forcing, but if the key is very long it could easily take too long to be helpful.

share|improve this answer
    
Cant we pass the file to any decrypt algorithm ... which could find the actual key.... –  Pavunkumar Feb 5 '11 at 5:53
1  
@pavun_cool: that would render any encryption useless, wouldnt it? –  akira Feb 5 '11 at 6:54
    
@pavun_cool: and btw .. that "decrypt algorithm" is called "try all available keys till something does not look like garbage", aka "brute force" .. this is the right answer, even if you dont like it. –  akira Feb 9 '11 at 8:40

Short answer: No, it is not possible. (As others have mentioned.) See ":help encryption" and take note of the warnings.

Long answer: Vim can optionally use two encryption methods:

  1. The original—and default—is considered weak and potentially "broken," is based on zip's encryption scheme. There are supposedly zip encryption cracking programs out there, but I haven't ever been able to make one work, and they certainly would not work with Vim's encrypted files without modification.
  2. The new encryption scheme, introduced in 7.3, is Blowfish. You'd have to more than burn out a sun to gain the power alone needed to brute-force that key, which—assuming that there wasn't a mistake in implementing this method in Vim or there is no core flaw in the Blowfish algorithm—is probably the only way you'd manage to gain access to the file.

See ":help 'cryptmethod'"

I will also reiterate what others have said here: The encryption would not be much use if it were so easily broken.

I suggest that you should always write your passwords down in a secure place; install a decent "password safe" application such as KeePass.

share|improve this answer

Can't be done. Although Vim just uses standard algorithms (AES, I believe) to encrypt/decrypt files, it doesn't matter what program or library you use you're not going to decrypt it without the key. Algorithms like these work not because they're unbreakable, but because it takes an insanely long time to brute-force them (as in thousands of years at current computing abilities).

share|improve this answer
    
vim uses blowfish since 7.3 (or its homebrew encryption, which is 'rather weak') –  akira Feb 5 '11 at 6:23

If you had recently edited the file (when you last remembered the password), check in your temp folder, there should be a file with the contents. It would have a tilde at the end of the filename.

share|improve this answer
    
This definitely should not work; the backup file (the file with a tilde) should also be encrypted. If it you are seeing situations where it is not, you need to create a bug report where it is reproducible and send it to bugs@vim.org and vim-dev@vim.org. –  Heptite Feb 5 '11 at 18:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.