]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.816 v7.3.816
authorBram Moolenaar <Bram@vim.org>
Wed, 13 Feb 2013 16:35:04 +0000 (17:35 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 13 Feb 2013 16:35:04 +0000 (17:35 +0100)
Problem:    Can't compute a hash.
Solution:   Add the sha256() function. (Tyru, Hirohito Higashi)

runtime/doc/eval.txt
src/eval.c
src/proto/sha256.pro
src/sha256.c
src/testdir/Make_amiga.mak
src/testdir/Make_dos.mak
src/testdir/Make_ming.mak
src/testdir/Make_os2.mak
src/testdir/Make_vms.mms
src/testdir/Makefile
src/version.c

index 9819d9bc90ddc475c95afe26d45e653162359b5b..b1748c16a1c8eabbfbaf64a8bd190fa4280dceba 100644 (file)
@@ -1931,6 +1931,7 @@ settabvar( {nr}, {varname}, {val})        set {varname} in tab page {nr} to {val}
 settabwinvar( {tabnr}, {winnr}, {varname}, {val})    set {varname} in window
                                        {winnr} in tab page {tabnr} to {val}
 setwinvar( {nr}, {varname}, {val})     set {varname} in window {nr} to {val}
+sha256( {string})              String  SHA256 checksum of {string}
 shellescape( {string} [, {special}])
                                String  escape {string} for use as shell
                                        command argument
@@ -5336,6 +5337,11 @@ setwinvar({nr}, {varname}, {val})                        *setwinvar()*
                        :call setwinvar(1, "&list", 0)
                        :call setwinvar(2, "myvar", "foobar")
 
+sha256({string})                                               *sha256()*
+               Returns a String with 64 hex charactes, which is the SHA256
+               checksum of {string}.
+               {only available when compiled with the |+cryptv| feature}
+
 shellescape({string} [, {special}])                    *shellescape()*
                Escape {string} for use as a shell command argument.
                On MS-Windows and MS-DOS, when 'shellslash' is not set, it
index dc7c2409f1bd9135a284f6aa177ca962be2f4534..9f63d4525d6d427d8613bae3e7e74850e89ca7ca 100644 (file)
@@ -688,6 +688,9 @@ static void f_setreg __ARGS((typval_T *argvars, typval_T *rettv));
 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 @@ static struct fst
     {"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},
@@ -16710,6 +16716,24 @@ setwinvar(argvars, rettv, off)
     }
 }
 
+#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 = vim_strsave(
+                                   sha256_bytes(p, (int)STRLEN(p), NULL, 0));
+    rettv->v_type = VAR_STRING;
+}
+#endif /* FEAT_CRYPT */
+
 /*
  * "shellescape({string})" function
  */
index 3c4d975d23f55dd5be06b51e1bd4f1d1fea7cbaa..464b35434d2fcf533aea2d574977977456077d0a 100644 (file)
@@ -2,6 +2,7 @@
 void sha256_start __ARGS((context_sha256_T *ctx));
 void sha256_update __ARGS((context_sha256_T *ctx, char_u *input, UINT32_T length));
 void sha256_finish __ARGS((context_sha256_T *ctx, char_u digest[32]));
+char_u *sha256_bytes __ARGS((char_u *buf, int buf_len, char_u *salt, int salt_len));
 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));
index 3392fc08e85423cf79ea456064ae663efe81b646..0cfe0eb5935d227abe6ee95f9398c142d77e7df8 100644 (file)
@@ -273,14 +273,13 @@ sha256_finish(ctx, digest)
 #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));
 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;
index c1a8bd6b8528f5553765063fa2defe838826ccfc..19d891074f031a4f234fc97604c3a84dd5f488a0 100644 (file)
@@ -32,7 +32,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
                test71.out test72.out test73.out test74.out test75.out \
                test76.out test77.out test78.out test79.out test80.out \
                test81.out test82.out test83.out test84.out test88.out \
-               test89.out
+               test89.out test90.out
 
 .SUFFIXES: .in .out
 
@@ -138,3 +138,4 @@ test83.out: test83.in
 test84.out: test84.in
 test88.out: test88.in
 test89.out: test89.in
+test90.out: test90.in
index fb52e807936e307ca6e594cb51103e5178b3a6e3..99963e8b3cf73f3f85f9347655837a6c9b4dbed4 100644 (file)
@@ -31,7 +31,7 @@ SCRIPTS =     test3.out test4.out test5.out test6.out test7.out \
                test74.out test75.out test76.out test77.out test78.out \
                test79.out test80.out test81.out test82.out test83.out \
                test84.out test85.out test86.out test87.out test88.out \
-               test89.out
+               test89.out test90.out
 
 SCRIPTS32 =    test50.out test70.out
 
index 8aab596aa59cdd1078e2fbdf718ceafac6b4728d..32d1db5f7b458ff325ddb4b174bd73907a513fd8 100644 (file)
@@ -51,7 +51,7 @@ SCRIPTS =     test3.out test4.out test5.out test6.out test7.out \
                test74.out test75.out test76.out test77.out test78.out \
                test79.out test80.out test81.out test82.out test83.out \
                test84.out test85.out test86.out test87.out test88.out \
-               test89.out
+               test89.out test90.out
 
 SCRIPTS32 =    test50.out test70.out
 
index d052855d3fec74627bef91d402b8ebf6c475264a..2f46a415a823b69c720318a8b2a8c94f05078cf7 100644 (file)
@@ -32,7 +32,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
                test71.out test72.out test73.out test74.out test75.out \
                test76.out test77.out test78.out test79.out test80.out \
                test81.out test82.out test83.out test84.out test88.out \
-               test89.out
+               test89.out test90.out
 
 .SUFFIXES: .in .out
 
index df5b6602ddd515aa7f1c9a9b5be8626526abefc3..a0d29d768237ebc5f3c93fee1541460ea984ccc1 100644 (file)
@@ -4,7 +4,7 @@
 # Authors:     Zoltan Arpadffy, <arpadffy@polarhome.com>
 #              Sandor Kopanyi,  <sandor.kopanyi@mailbox.hu>
 #
-# Last change:  2012 Dec 05
+# Last change:  2013 Feb 13
 #
 # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
 # Edit the lines in the Configuration section below to select.
@@ -76,7 +76,8 @@ SCRIPT = test1.out  test2.out  test3.out  test4.out  test5.out  \
         test66.out test67.out test68.out test69.out \
         test71.out test72.out test74.out test75.out test76.out \
         test77.out test78.out test79.out test80.out test81.out \
-        test82.out test83.out test84.out test88.out test89.out
+        test82.out test83.out test84.out test88.out test89.out \
+        test90.out
 
 # Known problems:
 # Test 30: a problem around mac format - unknown reason
index 6ca89dc9d4851a831ad471eb8ab970b919f25ab1..1920834005bfaaf05f32cbb8d8ba64e4c542150e 100644 (file)
@@ -28,7 +28,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
                test74.out test75.out test76.out test77.out test78.out \
                test79.out test80.out test81.out test82.out test83.out \
                test84.out test85.out test86.out test87.out test88.out \
-               test89.out
+               test89.out test90.out
 
 SCRIPTS_GUI = test16.out
 
index 5a9f65d183e1da15a99a7c53c2248090eb425b1d..06f4f88c60e7efd11ecfea024849931dfd43f9e1 100644 (file)
@@ -725,6 +725,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    816,
 /**/
     815,
 /**/