Friday, December 31, 2010

Re: macro for an affine cipher

HAPPY NEW YEAR everybody!

I've made some progress for my quest to secure my files. Having seen that vim can interact with perl using :perl and :.perldo , I've dropped the affine cipher in favor of just using perl's existing crypto modules available at www.cpan.org .

So I've built a perl script that takes four arguments:
1) a 'steering' value "en" or "de"
2) the key
3) name of input file
4) name of output file

and works great when executed from within the Command Window i.e.

perl mycoolscript.pl en DontWorryBeHappy plaintext.txt secure.txt

Now I'd like to modify it to be runnable from within a vim session and execute against the whole file (buffer?) at once.

For example, you have a textfile containing all your passwords.
You want this file to remain encrypted on the hard drive.
You wish to open the file in vim, execute something like:
:.perldo mycoolscript.pl de DontWorryBeHappy
and =PRESTO= the file is decrypted
You make a few changes then
:.perldo mycoolscript.pl en DontWorryBeHappy
and =PRESTO= the file is encrypted again. You
:wq
and are done.

(you'd have to perform an initial encryption, of course)

The benefit here is the file exists in decrypted form only in memory.

So there you have it. How can I achieve this?

TIA and HNY!,

Still-learning Stuart

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: