diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2021-06-01 20:28:24 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-06-01 20:39:04 +0200 |
commit | 5cffb7179fee6d70d5c8cee5b5c18ec51f1272f6 (patch) | |
tree | 9ed26ffd6cfd3d0e1dadfb83322e10b5eca04fce /doc | |
parent | 6ac6cf729329559fa80ece1c057cb56fac81ff30 (diff) | |
download | weechat-5cffb7179fee6d70d5c8cee5b5c18ec51f1272f6.zip |
api: add function crypto_hmac (issue #1628)
Diffstat (limited to 'doc')
-rw-r--r-- | doc/en/weechat_plugin_api.en.adoc | 48 | ||||
-rw-r--r-- | doc/fr/weechat_plugin_api.fr.adoc | 50 | ||||
-rw-r--r-- | doc/it/weechat_plugin_api.it.adoc | 49 | ||||
-rw-r--r-- | doc/ja/weechat_plugin_api.ja.adoc | 49 |
4 files changed, 196 insertions, 0 deletions
diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc index 6f1c4de1b..dde1f532c 100644 --- a/doc/en/weechat_plugin_api.en.adoc +++ b/doc/en/weechat_plugin_api.en.adoc @@ -3626,6 +3626,54 @@ rc = weechat_crypto_hash_pbkdf2 (data, strlen (data), "sha256", salt, strlen (sa [NOTE] This function is not available in scripting API. +==== crypto_hmac + +_WeeChat ≥ 3.2._ + +Compute keyed-hash message authentication code (HMAC). + +Prototype: + +[source,C] +---- +int weechat_crypto_hmac (const void *key, int key_size, const void *message, int message_size, + int hash_algo, void *hash, int *hash_size); +---- + +Arguments: + +* _key_: the key +* _key_size_: number of bytes in _key_ +* _message_: the message +* _message_size_: number of bytes in _message_ +* _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] +---- +const char *key = "the key"; +const char *message = "the message"; +char hash[256 / 8]; +int rc, hash_size; +rc = weechat_crypto_hmac (key, strlen (key), message, strlen (message), "sha256", hash, &hash_size); +/* rc == 1, hash_size == 32 and hash is a buffer with: + 47 36 67 02 fc bc b1 97 a4 25 e6 7a b9 52 92 bd 15 9a 66 91 9c fb 94 b0 b4 9a 39 cb c0 24 2d 7b */ +---- + +[NOTE] +This function is not available in scripting API. + [[directories]] === Directories diff --git a/doc/fr/weechat_plugin_api.fr.adoc b/doc/fr/weechat_plugin_api.fr.adoc index 65cc46414..7d4c0d92d 100644 --- a/doc/fr/weechat_plugin_api.fr.adoc +++ b/doc/fr/weechat_plugin_api.fr.adoc @@ -3687,6 +3687,56 @@ rc = weechat_crypto_hash_pbkdf2 (data, strlen (data), "sha256", salt, strlen (sa [NOTE] Cette fonction n'est pas disponible dans l'API script. +==== crypto_hmac + +_WeeChat ≥ 3.2._ + +Calculer le code d'authentification d'une empreinte cryptographique de message +avec clé (HMAC). + +Prototype : + +[source,C] +---- +int weechat_crypto_hmac (const void *key, int key_size, const void *message, int message_size, + int hash_algo, void *hash, int *hash_size); +---- + +Paramètres : + +* _key_ : la clé +* _key_size_ : nombre d'octets dans _key_ +* _message_ : le message +* _message_size_ : nombre d'octets dans _message_ +* _hash_algo_ : l'algorithme de hachage, voir le tableau dans la fonction + <<crypto_hash_algorithms,crypto_hash>> +* _hash_ : pointeur vers la variable de hachage, qui est utilisée pour stocker + le résultat du hachage (le tampon doit être suffisamment grand, selon + l'algorithme, voir le tableau dans la fonction + <<crypto_hash_algorithms,crypto_hash>>) +* _hash_size_ : pointeur vers une variable utiliser pour stocker la longueur + du résultat du hachage (en octets) (peut être NULL) + +Valeur de retour : + +* 1 si OK, 0 si erreur + +Exemple en C : + +[source,C] +---- +const char *key = "the key"; +const char *message = "the message"; +char hash[256 / 8]; +int rc, hash_size; +rc = weechat_crypto_hmac (key, strlen (key), message, strlen (message), "sha256", hash, &hash_size); +/* rc == 1, hash_size == 32 et hash est un tampon avec : + 47 36 67 02 fc bc b1 97 a4 25 e6 7a b9 52 92 bd 15 9a 66 91 9c fb 94 b0 b4 9a 39 cb c0 24 2d 7b */ +---- + +[NOTE] +Cette fonction n'est pas disponible dans l'API script. + [[directories]] === Répertoires diff --git a/doc/it/weechat_plugin_api.it.adoc b/doc/it/weechat_plugin_api.it.adoc index 1d266f083..667c09c38 100644 --- a/doc/it/weechat_plugin_api.it.adoc +++ b/doc/it/weechat_plugin_api.it.adoc @@ -3764,6 +3764,55 @@ Questa funzione non è disponibile nelle API per lo scripting. Alcune funzioni legate alle cartelle. +// TRANSLATION MISSING +==== crypto_hmac + +_WeeChat ≥ 3.2._ + +Compute keyed-hash message authentication code (HMAC). + +Prototipo: + +[source,C] +---- +int weechat_crypto_hmac (const void *key, int key_size, const void *message, int message_size, + int hash_algo, void *hash, int *hash_size); +---- + +Argomenti: + +* _key_: the key +* _key_size_: number of bytes in _key_ +* _message_: the message +* _message_size_: number of bytes in _message_ +* _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) + +Valore restituito: + +* 1 if OK, 0 if error + +Esempio in C: + +[source,C] +---- +const char *key = "the key"; +const char *message = "the message"; +char hash[256 / 8]; +int rc, hash_size; +rc = weechat_crypto_hmac (key, strlen (key), message, strlen (message), "sha256", hash, &hash_size); +/* rc == 1, hash_size == 32 and hash is a buffer with: + 47 36 67 02 fc bc b1 97 a4 25 e6 7a b9 52 92 bd 15 9a 66 91 9c fb 94 b0 b4 9a 39 cb c0 24 2d 7b */ +---- + +[NOTE] +Questa funzione non è disponibile nelle API per lo scripting. + ==== mkdir_home // TRANSLATION MISSING diff --git a/doc/ja/weechat_plugin_api.ja.adoc b/doc/ja/weechat_plugin_api.ja.adoc index b88949e48..ea645d493 100644 --- a/doc/ja/weechat_plugin_api.ja.adoc +++ b/doc/ja/weechat_plugin_api.ja.adoc @@ -3670,6 +3670,55 @@ rc = weechat_crypto_hash_pbkdf2 (data, strlen (data), "sha256", salt, strlen (sa [NOTE] スクリプト API ではこの関数を利用できません。 +// TRANSLATION MISSING +==== crypto_hmac + +_WeeChat バージョン 3.2 以上で利用可。_ + +Compute keyed-hash message authentication code (HMAC). + +プロトタイプ: + +[source,C] +---- +int weechat_crypto_hmac (const void *key, int key_size, const void *message, int message_size, + int hash_algo, void *hash, int *hash_size); +---- + +引数: + +* _key_: the key +* _key_size_: number of bytes in _key_ +* _message_: the message +* _message_size_: number of bytes in _message_ +* _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) + +戻り値: + +* 成功した場合は 1、失敗した場合は 0 + +C 言語での使用例: + +[source,C] +---- +const char *key = "the key"; +const char *message = "the message"; +char hash[256 / 8]; +int rc, hash_size; +rc = weechat_crypto_hmac (key, strlen (key), message, strlen (message), "sha256", hash, &hash_size); +/* rc == 1, hash_size == 32 and hash is a buffer with: + 47 36 67 02 fc bc b1 97 a4 25 e6 7a b9 52 92 bd 15 9a 66 91 9c fb 94 b0 b4 9a 39 cb c0 24 2d 7b */ +---- + +[NOTE] +スクリプト API ではこの関数を利用できません。 + [[directories]] === ディレクトリ |