diff -r b89e2bdcc6e5 src/eval.c
--- a/src/eval.c	Sun Dec 16 12:50:40 2012 +0100
+++ b/src/eval.c	Tue Jan 08 20:26:35 2013 +0900
@@ -688,6 +688,9 @@
 static void f_settabvar __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_settabwinvar __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_setwinvar __ARGS((typval_T *argvars, typval_T *rettv));
+#ifdef FEAT_CRYPT
+static void f_sha256 __ARGS((typval_T *argvars, typval_T *rettv));
+#endif /* FEAT_CRYPT */
 static void f_shellescape __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_shiftwidth __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_simplify __ARGS((typval_T *argvars, typval_T *rettv));
@@ -8055,6 +8058,9 @@
     {"settabvar",	3, 3, f_settabvar},
     {"settabwinvar",	4, 4, f_settabwinvar},
     {"setwinvar",	3, 3, f_setwinvar},
+#ifdef FEAT_CRYPT
+    {"sha256",		1, 1, f_sha256},
+#endif
     {"shellescape",	1, 2, f_shellescape},
     {"shiftwidth",	0, 0, f_shiftwidth},
     {"simplify",	1, 1, f_simplify},
@@ -16675,6 +16681,25 @@
     }
 }
 
+#ifdef FEAT_CRYPT
+/*
+ * "sha256({string})" function
+ */
+    static void
+f_sha256(argvars, rettv)
+    typval_T	*argvars;
+    typval_T	*rettv;
+{
+    char_u	*p;
+
+    p = get_tv_string(&argvars[0]);
+    rettv->vval.v_string = sha256_bytes(
+	p, (int)STRLEN(p), NULL, 0);
+    rettv->vval.v_string = vim_strsave(rettv->vval.v_string);
+    rettv->v_type = VAR_STRING;
+}
+#endif /* FEAT_CRYPT */
+
 /*
  * "shellescape({string})" function
  */
diff -r b89e2bdcc6e5 src/proto/sha256.pro
--- a/src/proto/sha256.pro	Sun Dec 16 12:50:40 2012 +0100
+++ b/src/proto/sha256.pro	Tue Jan 08 20:26:35 2013 +0900
@@ -5,4 +5,5 @@
 char_u *sha256_key __ARGS((char_u *buf, char_u *salt, int salt_len));
 int sha256_self_test __ARGS((void));
 void sha2_seed __ARGS((char_u *header, int header_len, char_u *salt, int salt_len));
+char_u *sha256_bytes __ARGS((char_u *buf, int buf_len, char_u *salt, int salt_len));
 /* vim: set ft=c : */
diff -r b89e2bdcc6e5 src/sha256.c
--- a/src/sha256.c	Sun Dec 16 12:50:40 2012 +0100
+++ b/src/sha256.c	Tue Jan 08 20:26:35 2013 +0900
@@ -273,14 +273,14 @@
 #endif /* FEAT_CRYPT || FEAT_PERSISTENT_UNDO */
 
 #if defined(FEAT_CRYPT) || defined(PROTO)
-static char_u *sha256_bytes __ARGS((char_u *buf, int buf_len, char_u *salt, int salt_len));
+char_u *sha256_bytes __ARGS((char_u *buf, int buf_len, char_u *salt, int salt_len));
 static unsigned int get_some_time __ARGS((void));
 
 /*
  * Returns hex digest of "buf[buf_len]" in a static array.
  * if "salt" is not NULL also do "salt[salt_len]".
  */
-    static char_u *
+    char_u *
 sha256_bytes(buf, buf_len, salt, salt_len)
     char_u *buf;
     int    buf_len;
