0

I have a password protected file in vim.

Yesterday when I tried to open it in vim, got random characters.

I tried to open it in vim in different OS (Linux, Windows, MacOS) and different vim versions (8 and 9), in vain.

I tried also with backups of the file, without success.

I used the password hundreds of times in the last few years, so it's unlikely I forgot it.

How can we explain this and what else can I try ?

5
  • Do you have or remember the version of Vim that correctly decrypted the file?
    – 3N4N
    Oct 24, 2022 at 9:46
  • Which version of the encryption are you using? This is stored in the file itself at the start, VimCrypt~ followed by a number (01, 02, 03, or 04). You can check by pressing ^C at the password prompt which will display the "raw" file, or with something like less -F file or head -c 12 file. And what does :set cryptmethod? show after you've opened the password protected file and entered the password? Oct 24, 2022 at 9:57
  • @kadekai I think version 8 worked fine.
    – Philippe
    Oct 24, 2022 at 10:20
  • @MartinTournoij head -c 12 file gave VimCrypt~01!
    – Philippe
    Oct 24, 2022 at 10:22
  • You can try with a very old version of Vim maybe; VimCrypt~01! is the old (insecure) cryptmethod=zip that's been around forever, so maybe try Vim 7.4 or 7.3? If that doesn't work then my best guess is that either the file and its backups are corrupted, or you somehow did end up using the wrong password after all (maybe you typo'd it when you encrypted the file?) Oct 24, 2022 at 12:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.