updated for version 7.4.399
Problem:    Encryption implementation is messy.  Blowfish encryption has a
            weakness.
Solution:   Refactor the encryption, store the state in an allocated struct
            instead of using a save/restore mechanism.  Introduce the
            "blowfish2" method, which does not have the weakness and encrypts
            the whole undo file. (largely by David Leadbeater)
diff --git a/src/testdir/test71.in b/src/testdir/test71.in
index 155fd41..944b69d 100644
--- a/src/testdir/test71.in
+++ b/src/testdir/test71.in
@@ -13,6 +13,8 @@
 :let cm0_bytes = getline('.', '.')
 :/^start of cm=blowfish bytes/+1
 :let cm1_bytes = getline('.', '.')
+:/^start of cm=blowfish2 bytes/+1
+:let cm2_bytes = getline('.', '.')
 :bwipe!
 :call append(0, text_lines)
 :$d
@@ -36,6 +38,18 @@
 :e Xtestfile
 barfoo
 :let cm1_read_back = getline('.', '$')
+:set key=
+:set cryptmethod=blowfish2
+:" If the blowfish test fails 'cryptmethod' will be 'zip' now.
+:%s/^/\=&cryptmethod == 'blowfish2' ? "OK " : "blowfish test failed "/
+:X
+bar2foo
+bar2foo
+:w! Xtestfile
+:bwipe!
+:e Xtestfile
+bar2foo
+:let cm2_read_back = getline('.', '$')
 :bwipe!
 :set bin noeol key=
 :call append(0, cm0_bytes)
@@ -57,7 +71,20 @@
 :set nobin
 :e Xtestfile
 barbar
+:let cm1_read_bin = getline('.', '$')
+:bwipe!
+:set bin noeol key=
+:call append(0, cm2_bytes)
+:$d
+:set fenc=latin1
+:w! Xtestfile
+:bwipe!
+:set nobin
+:e Xtestfile
+barburp
+:call append(0, cm1_read_bin)
 :call append(0, cm0_read_bin)
+:call append(0, cm2_read_back)
 :call append(0, cm1_read_back)
 :call append(0, cm0_read_back)
 :set key= fenc=latin1
diff --git a/src/testdir/test71.ok b/src/testdir/test71.ok
index 24652c4..de1b0ab 100644
--- a/src/testdir/test71.ok
+++ b/src/testdir/test71.ok
@@ -4,7 +4,12 @@
 OK 01234567890123456789012345678901234567
 OK line 2  foo bar blah
 OK line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+OK OK 01234567890123456789012345678901234567
+OK OK line 2  foo bar blah
+OK OK line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 1234567890
 aábbccddeëff
 asdfasdfasdf
 0001112223333
+abcdefghijklmnopqrstuvwxyz
+!@#$%^&*()_+=-`~
diff --git a/src/testdir/test71a.in b/src/testdir/test71a.in
index 85bd22c..e79a398 100644
--- a/src/testdir/test71a.in
+++ b/src/testdir/test71a.in
Binary files differ
diff --git a/src/testdir/test72.in b/src/testdir/test72.in
index 3b3a6a4..031edbf 100644
--- a/src/testdir/test72.in
+++ b/src/testdir/test72.in
@@ -81,6 +81,7 @@
 :"
 :" With encryption, cryptmethod=blowfish
 :e! Xtestfile
+rubbish
 :set undofile cm=blowfish
 ggdGijan
 feb
@@ -104,6 +105,32 @@
 u:.w >>test.out
 u:.w >>test.out
 :"
+:" With encryption, cryptmethod=blowfish2
+:e! Xtestfile
+rubbish
+:set undofile cm=blowfish2
+ggdGijan
+feb
+mar
+apr
+jun:set ul=100
+kk0ifoo :set ul=100
+dd:set ul=100
+ibar :set ul=100
+:X
+foo2bar
+foo2bar
+:w!
+:bwipe!
+:e Xtestfile
+foo2bar
+:set key=
+/bar
+:.w >>test.out
+u:.w >>test.out
+u:.w >>test.out
+u:.w >>test.out
+:"
 :" Rename the undo file so that it gets cleaned up.
 :if has("vms")
 : call rename("_un_Xtestfile", "Xtestundo")
diff --git a/src/testdir/test72.ok b/src/testdir/test72.ok
index bb267d0..8d30ba1 100644
--- a/src/testdir/test72.ok
+++ b/src/testdir/test72.ok
@@ -25,3 +25,7 @@
 apr
 foo mar
 mar
+bar apr
+apr
+foo mar
+mar