Friday, December 18, 2015

Re: Re:Re: Blowfish[2] failed to encrypt big text file of 24MB

Hi Bram,

2015/12/19 Sat 4:47:19 UTC+9 Bram Moolenaar wrote:
> Ken Takata wrote:
>
> > 2015/2/14 Sat 6:04:00 UTC+9 Bram Moolenaar wrote:
> > > Ben Fritz wrote:
> > >
> > > > On Friday, February 13, 2015 at 4:16:01 AM UTC-6, might1 wrote:
> > > > > At 2015-02-13 18:00:32,"might1" <might1@126.com> wrote:
> > > > > > Right now, I just tried vim7.4 downloaded from www.vim.org.
> > > > > According to your way, I tried in commanld line 'vim -u NONE -N
> > > > > test.txt'   and  'gvim -u NONE -N test.txt' to encrypt with blowfish
> > > > > method, both failed. The resulting files all growed to 113MB. Really
> > > > > strange! No error jumped out.
> > > > >
> > > > > Do you need I attach the resulting encrypted file whose size remains 113MB after max compression?
> > > > >
> > > >
> > > > Actually, attaching the already encrypted file is pretty much useless.
> > > >
> > > > I experimented some, with the attached toy input file (compressed with 7-zip to avoid a huge attachment), and found that the issue seems to be related to writing *new* files somehow.
> > > >
> > > > If I create an encrypted output file as follows, everything works fine:
> > > >
> > > > :e encrypt_in.txt
> > > > :saveas encrypt_blowfish2.txt
> > > > :X
> > > > password
> > > > password
> > > > :w
> > > >
> > > > However, if I encrypt as follows, I see the E381 error repeated a bunch of times, and Vim seems to hang if I quit that error and try the password again and write, presumably creating that giant file the OP mentioned:
> > > >
> > > > :r encrypt_in.txt
> > > > ggdd
> > > > :X
> > > > password
> > > > password
> > > > :w encrypt_blowfish2.txt
> > > >
> > > > Oddly enough, this also fails:
> > > >
> > > > :r encrypt_in.txt
> > > > ggdd
> > > > :w encrypt_blowfish2.txt
> > > > :X
> > > > password
> > > > password
> > > > :w
> > > >
> > > > But this succeeds (after a really long time):
> > > >
> > > > :r encrypt_in.txt
> > > > ggdd
> > > > :w encrypt_blowfish2.txt
> > > > :e
> > > > :X
> > > > password
> > > > password
> > > > :w
> > > >
> > > > It seems to be related to encrypting the swapfile for the new file. This fails:
> > > >
> > > > :set swapfile noundofile
> > > > :r encrypt_in.txt
> > > > ggdd
> > > > :X
> > > > password
> > > > password
> > > > :w encrypt_blowfish2.txt
> > > >
> > > > But this succeeds:
> > > >
> > > > :set noswapfile undofile
> > > > :r encrypt_in.txt
> > > > ggdd
> > > > :X
> > > > password
> > > > password
> > > > :w encrypt_blowfish2.txt
> > > >
> > > > Using the following Vim version on Windows 7:
> > > >
> > > > VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Feb 4 2015 10:16:41)
> > > > MS-Windows 64-bit GUI version with OLE support
> > > > Included patches: 1-608
> > >
> > > [...]
> > >
> > > Since it works fine on Linux, could it be related to "long" not being
> > > able to store a pointer? It's a common problem for porting a C program
> > > to Windows.
>
> It's most likely related to the memory limit, causing Vim to use the
> swap file.
>
> > Perhaps I found a fix for this.
>
> Thanks! Although I think only the first part matters, when writing the
> old key isn't used.

Ah, you are right!
I confirmed that the second part was not needed.

Regards,
Ken Takata

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: