patch 9.1.1774: cannot calculate sha256 of a Blob

Problem:  cannot calculate sha256() of a Blob
Solution: Change sha256() to accept a Blob or String argument
          (thinca).

closes: #18336

Signed-off-by: thinca <thinca@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
thinca
2025-09-18 20:22:23 +00:00
committed by Christian Brabandt
parent e8b0e926d0
commit 4150283b83
6 changed files with 49 additions and 13 deletions

View File

@ -1,4 +1,4 @@
*builtin.txt* For Vim version 9.1. Last change: 2025 Sep 15
*builtin.txt* For Vim version 9.1. Last change: 2025 Sep 18
VIM REFERENCE MANUAL by Bram Moolenaar
@ -575,7 +575,7 @@ settabwinvar({tabnr}, {winnr}, {varname}, {val})
settagstack({nr}, {dict} [, {action}])
Number modify tag stack using {dict}
setwinvar({nr}, {varname}, {val}) none set {varname} in window {nr} to {val}
sha256({string}) String SHA256 checksum of {string}
sha256({expr}) String SHA256 checksum of String or Blob
shellescape({string} [, {special}])
String escape {string} for use as shell
command argument
@ -10336,12 +10336,14 @@ setwinvar({winnr}, {varname}, {val}) *setwinvar()*
Return type: |Number|
sha256({string}) *sha256()*
sha256({expr}) *sha256()*
Returns a String with 64 hex characters, which is the SHA256
checksum of {string}.
checksum of {expr}.
{expr} is a String or a Blob.
Can also be used as a |method|: >
GetText()->sha256()
GetBlob()->sha256()
<
Return type: |String|

View File

@ -1,4 +1,4 @@
*version9.txt* For Vim version 9.1. Last change: 2025 Sep 15
*version9.txt* For Vim version 9.1. Last change: 2025 Sep 18
VIM REFERENCE MANUAL by Bram Moolenaar
@ -41735,6 +41735,7 @@ Functions: ~
- |chdir()| allows to optionally specify a scope argument
- |matchfuzzy()| and |matchfuzzypos()| use an improved fuzzy matching
algorithm (same as fzy).
- |sha256()| also accepts a |Blob| as argument.
Others: ~
- the regex engines match correctly case-insensitive multi-byte characters