diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index cad2e98..41326a9 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1085,7 +1085,6 @@
 - using NSIS 2.46: install on Windows 7 works, but no "Edit with Vim" menu.
    Use register_shell_extension()? (George Reilly, 2010 May 26)
    Ron's version: http://dev.ronware.org/p/vim/finfo?name=gvim.nsi
-- Undo code: use union to store long in place of pointers?
 - Also crypt the swap file, each block separately.  Change mf_write() and
     mf_read().  How to get b_p_key to these functions?
     Generate seed for each block, store in pointer block.  Block 1 is not
@@ -1095,8 +1094,11 @@
     Verify recovery works.
 - Update for crypt code to use salt. (Mohsin May 30)
     Make the strengthen_key value configurable and store it in the header.
-- Do profiling on sha256 code to find obvious bottlenecks.
 - Do profiling on crypt code to find obvious bottlenecks.
+    bf_ranbyte() and bf_ofb_init() are called for each byte, can they be done
+    inline somehow?
+    -> Add a function in blowfish.c to process an array, called once from
+       crypt_decode() and crypt_encode().
 Patches to include:
 - Include conceal patch?
   http://vince.negri.googlepages.com/
diff --git a/src/blowfish.c b/src/blowfish.c
index e449da3..f88cbfd 100644
--- a/src/blowfish.c
+++ b/src/blowfish.c
@@ -18,6 +18,7 @@
 #define ARRAY_LENGTH(A)      (sizeof(A)/sizeof(A[0]))
 
 #define BF_BLOCK    8
+#define BF_BLOCK_MASK 7
 #define BF_OFB_LEN  (8*(BF_BLOCK))
 
 typedef union {
@@ -563,14 +564,14 @@
     int
 bf_ranbyte()
 {
-    int current_byte = randbyte_offset++;
-    int current_block = (current_byte / BF_BLOCK) * BF_BLOCK;
+    int b;
 
-    if (randbyte_offset == BF_OFB_LEN)
+    if ((randbyte_offset & BF_BLOCK_MASK) == 0)
+	bf_e_cblock(&ofb_buffer[randbyte_offset]);
+    b = ofb_buffer[randbyte_offset];
+    if (++randbyte_offset == BF_OFB_LEN)
 	randbyte_offset = 0;
-    if ((current_byte % BF_BLOCK) == 0)
-	bf_e_cblock(&ofb_buffer[current_block]);
-    return ofb_buffer[current_byte];
+    return b;
 }
 
 /*
diff --git a/src/fileio.c b/src/fileio.c
index 4a9a7f1..889e4ff 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1426,8 +1426,7 @@
 		 * Decrypt the read bytes.
 		 */
 		if (cryptkey != NULL && size > 0)
-		    for (p = ptr; p < ptr + size; ++p)
-			ZDECODE(*p);
+		    crypt_decode(ptr, size);
 #endif
 	    }
 	    skip_read = FALSE;
@@ -3004,7 +3003,6 @@
 {
     char_u  *copy;
     char_u  small_buf[100];
-    int	    ztemp, t;
     size_t  i;
 
     if (*buf->b_p_key == NUL)
@@ -3017,11 +3015,7 @@
 	if (copy == NULL)
 	    return 0;
     }
-    for (i = 0; i < len; ++i)
-    {
-	ztemp = ptr[i];
-	copy[i] = ZENCODE(ztemp, t);
-    }
+    crypt_encode(ptr, len, copy);
     i = fwrite(copy, len, (size_t)1, fp);
     if (copy != small_buf)
 	vim_free(copy);
@@ -3039,12 +3033,10 @@
     int	    len;
 {
     char_u  *ptr;
-    char_u  *p;
 
     ptr = read_string(fd, len);
     if (ptr != NULL || *buf->b_p_key != NUL)
-	for (p = ptr; p < ptr + len; ++p)
-	    ZDECODE(*p);
+	crypt_decode(ptr, len);
     return ptr;
 }
 
@@ -5678,15 +5670,7 @@
 
 #ifdef FEAT_CRYPT
     if (flags & FIO_ENCRYPTED)		/* encrypt the data */
-    {
-	int ztemp, t, i;
-
-	for (i = 0; i < len; i++)
-	{
-	    ztemp = buf[i];
-	    buf[i] = ZENCODE(ztemp, t);
-	}
-    }
+	crypt_encode(buf, len, buf);
 #endif
 
     /* Repeat the write(), it may be interrupted by a signal. */
diff --git a/src/macros.h b/src/macros.h
index 51e4dd4..7fc5df0 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -227,21 +227,6 @@
 # endif
 #endif
 
-/*
- * Encryption macros.  Mohsin Ahmed, mosh@sasi.com 98-09-24
- * Based on zip/crypt sources.
- */
-
-#ifdef FEAT_CRYPT
-
-/* encode byte c, using temp t.  Warning: c must not have side effects. */
-# define ZENCODE(c, t)  (t = decrypt_byte(), update_keys(c), t^(c))
-
-/* decode byte c in place */
-# define ZDECODE(c)   update_keys(c ^= decrypt_byte())
-
-#endif
-
 #ifdef STARTUPTIME
 # define TIME_MSG(s) { if (time_fd != NULL) time_msg(s, NULL); }
 #else
diff --git a/src/misc2.c b/src/misc2.c
index 88b12aa..7a0a051 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -3724,39 +3724,81 @@
 
 #define CRC32(c, b) (crc_32_tab[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8))
 
-
 static ulg keys[3]; /* keys defining the pseudo-random sequence */
 
 /*
- * Return the next byte in the pseudo-random sequence
+ * Return the next byte in the pseudo-random sequence.
  */
-    int
-decrypt_byte()
-{
-    ush temp;
-
-    if (use_crypt_method > 0)
-	return bf_ranbyte();
-    temp = (ush)keys[2] | 2;
-    return (int)(((unsigned)(temp * (temp ^ 1)) >> 8) & 0xff);
+#define DECRYPT_BYTE_ZIP(t) { \
+    ush temp; \
+ \
+    temp = (ush)keys[2] | 2; \
+    t = (int)(((unsigned)(temp * (temp ^ 1)) >> 8) & 0xff); \
 }
 
 /*
- * Update the encryption keys with the next byte of plain text
+ * Update the encryption keys with the next byte of plain text.
+ */
+#define UPDATE_KEYS_ZIP(c) { \
+    keys[0] = CRC32(keys[0], (c)); \
+    keys[1] += keys[0] & 0xff; \
+    keys[1] = keys[1] * 134775813L + 1; \
+    keys[2] = CRC32(keys[2], (int)(keys[1] >> 24)); \
+}
+
+/*
+ * Encrypt "from[len]" into "to[len]".
+ * "from" and "to" can be equal to encrypt in place.
  */
     void
-update_keys(c)
-    int c;			/* byte of plain text */
+crypt_encode(from, len, to)
+    char_u	*from;
+    size_t	len;
+    char_u	*to;
 {
-    if (use_crypt_method > 0)
-	bf_ofb_update(c);
+    size_t	i;
+    int		ztemp, t;
+
+    if (use_crypt_method == 0)
+	for (i = 0; i < len; ++i)
+	{
+	    ztemp = from[i];
+	    DECRYPT_BYTE_ZIP(t);
+	    UPDATE_KEYS_ZIP(ztemp);
+	    to[i] = t ^ ztemp;
+	}
     else
-    {
-	keys[0] = CRC32(keys[0], c);
-	keys[1] += keys[0] & 0xff;
-	keys[1] = keys[1] * 134775813L + 1;
-	keys[2] = CRC32(keys[2], (int)(keys[1] >> 24));
-    }
+	for (i = 0; i < len; ++i)
+	{
+	    ztemp = from[i];
+	    t = bf_ranbyte();
+	    bf_ofb_update(ztemp);
+	    to[i] = t ^ ztemp;
+	}
+}
+
+/*
+ * Decrypt "ptr[len]" in place.
+ */
+    void
+crypt_decode(ptr, len)
+    char_u	*ptr;
+    long	len;
+{
+    char_u *p;
+
+    if (use_crypt_method == 0)
+	for (p = ptr; p < ptr + len; ++p)
+	{
+	    ush temp;
+
+	    temp = (ush)keys[2] | 2;
+	    temp = (int)(((unsigned)(temp * (temp ^ 1)) >> 8) & 0xff);
+	    UPDATE_KEYS_ZIP(*p ^= temp);
+	}
+    else
+	for (p = ptr; p < ptr + len; ++p)
+	    bf_ofb_update(*p ^= bf_ranbyte());
 }
 
 /*
@@ -3774,8 +3816,14 @@
 	keys[0] = 305419896L;
 	keys[1] = 591751049L;
 	keys[2] = 878082192L;
-	while (*passwd != '\0')
-	    update_keys((int)*passwd++);
+	if (use_crypt_method == 0)
+	    while (*passwd != '\0')
+	    {
+		UPDATE_KEYS_ZIP((int)*passwd++);
+	    }
+	else
+	    while (*passwd != '\0')
+		bf_ofb_update((int)*passwd++);
     }
 }
 
diff --git a/src/proto/misc2.pro b/src/proto/misc2.pro
index a688147..6b292bb 100644
--- a/src/proto/misc2.pro
+++ b/src/proto/misc2.pro
@@ -80,8 +80,8 @@
 char_u *parse_shape_opt __ARGS((int what));
 int get_shape_idx __ARGS((int mouse));
 void update_mouseshape __ARGS((int shape_idx));
-int decrypt_byte __ARGS((void));
-void update_keys __ARGS((int c));
+void crypt_encode __ARGS((char_u *from, size_t len, char_u *to));
+void crypt_decode __ARGS((char_u *ptr, long len));
 void crypt_init_keys __ARGS((char_u *passwd));
 void free_crypt_key __ARGS((char_u *key));
 char_u *get_crypt_key __ARGS((int store, int twice));
