diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2022-08-16 21:25:30 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2022-08-16 21:33:50 +0200 |
commit | 0090695f7d79efa4f50398b55bc59317d1de1d75 (patch) | |
tree | 9c1adbf669c3cdca080bd8aea4cbb9a119bb2d18 /doc/en/weechat_plugin_api.en.adoc | |
parent | e61441081520bcada6de699229ce9af241302665 (diff) | |
download | weechat-0090695f7d79efa4f50398b55bc59317d1de1d75.zip |
api: add function crypto_hash_file
Diffstat (limited to 'doc/en/weechat_plugin_api.en.adoc')
-rw-r--r-- | doc/en/weechat_plugin_api.en.adoc | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc index 6ac9e5440..7f69e8a67 100644 --- a/doc/en/weechat_plugin_api.en.adoc +++ b/doc/en/weechat_plugin_api.en.adoc @@ -3751,6 +3751,49 @@ rc = weechat_crypto_hash (data, strlen (data), "sha256", hash, &hash_size); [NOTE] This function is not available in scripting API. +==== crypto_hash_file + +_WeeChat ≥ 3.7._ + +Compute hash of a file. + +Prototype: + +[source,c] +---- +int weechat_crypto_hash_file (const char *filename, const char *hash_algo, + void *hash, int *hash_size); +---- + +Arguments: + +* _filename_: path and file name +* _hash_algo_: the hash algorithm, see table in function + <<crypto_hash_algorithms,crypto_hash>> +* _hash_: pointer to the hash variable, which is used to store the resulting hash + (the buffer must be large enough, according to the algorithm, see table in + function <<crypto_hash_algorithms,crypto_hash>>) +* _hash_size_: pointer to a variable used to store the size of the hash computed + (in bytes) (can be NULL) + +Return value: + +* 1 if OK, 0 if error + +C example: + +[source,c] +---- +char hash[256 / 8]; +int rc, hash_size; +rc = weechat_crypto_hash_file ("/path/to/file", "sha256", hash, &hash_size); +/* rc == 1, hash_size == 32 and hash is a buffer with: + 71 c4 80 df 93 d6 ae 2f 1e fa d1 44 7c 66 c9 52 5e 31 62 18 cf 51 fc 8d 9e d8 32 f2 da f1 8b 73 */ +---- + +[NOTE] +This function is not available in scripting API. + ==== crypto_hash_pbkdf2 _WeeChat ≥ 2.8._ |