mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
updated for version 7.3.816
Problem: Can't compute a hash. Solution: Add the sha256() function. (Tyru, Hirohito Higashi)
This commit is contained in:
@@ -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
|
||||
|
24
src/eval.c
24
src/eval.c
@@ -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
|
||||
*/
|
||||
|
@@ -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));
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -725,6 +725,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
816,
|
||||
/**/
|
||||
815,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user