diff options
-rw-r--r-- | doc/en/weechat_plugin_api.en.adoc | 2 | ||||
-rw-r--r-- | doc/fr/weechat_plugin_api.fr.adoc | 2 | ||||
-rw-r--r-- | doc/it/weechat_plugin_api.it.adoc | 2 | ||||
-rw-r--r-- | doc/ja/weechat_plugin_api.ja.adoc | 2 | ||||
-rw-r--r-- | src/core/wee-string.c | 2 | ||||
-rw-r--r-- | tests/unit/core/test-core-secure.cpp | 3 | ||||
-rw-r--r-- | tests/unit/core/test-core-string.cpp | 3 | ||||
-rw-r--r-- | tests/unit/core/test-core.h | 1 |
8 files changed, 17 insertions, 0 deletions
diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc index 622cef607..832eb91f6 100644 --- a/doc/en/weechat_plugin_api.en.adoc +++ b/doc/en/weechat_plugin_api.en.adoc @@ -2090,6 +2090,7 @@ Supported hash algorithms: [width="100%",cols="4,4,4,5,12",options="header"] |=== | Value | Algorithm | Hash size | Output (binary) | Notes +| `+crc32+` | CRC32 | 32 bits | 4 bytes | Not a hash algorithm in the cryptographic sense. | `+md5+` | MD5 | 128 bits | 16 bytes | *Weak*, not recommended for cryptography usage. | `+sha1+` | SHA-1 | 160 bits | 20 bytes | *Weak*, not recommended for cryptography usage. | `+sha224+` | SHA-224 | 224 bits | 28 bytes | @@ -2141,6 +2142,7 @@ Supported hash algorithms: [width="100%",cols="4,4,4,5,12",options="header"] |=== | Value | Algorithm | Hash size | Output (string) | Notes +| `+crc32+` | CRC32 | 32 bits | 8 hex chars | Not a hash algorithm in the cryptographic sense. | `+md5+` | MD5 | 128 bits | 32 hex chars | *Weak*, not recommended for cryptography usage. | `+sha1+` | SHA-1 | 160 bits | 40 hex chars | *Weak*, not recommended for cryptography usage. | `+sha224+` | SHA-224 | 224 bits | 56 hex chars | diff --git a/doc/fr/weechat_plugin_api.fr.adoc b/doc/fr/weechat_plugin_api.fr.adoc index 41189dfda..bb3987a18 100644 --- a/doc/fr/weechat_plugin_api.fr.adoc +++ b/doc/fr/weechat_plugin_api.fr.adoc @@ -2128,6 +2128,7 @@ Algorithmes de hachage supportés : [width="100%",cols="4,4,4,5,12",options="header"] |=== | Valeur | Algorithme | Taille du haché | Sortie (binaire) | Notes +| `+crc32+` | CRC32 | 32 bits | 4 octets | Pas un algorithme de hachage au sens cryptographique. | `+md5+` | MD5 | 128 bits | 16 octets | *Faible*, non recommandé pour un usage cryptographique. | `+sha1+` | SHA-1 | 160 bits | 20 octets | *Faible*, non recommandé pour un usage cryptographique. | `+sha224+` | SHA-224 | 224 bits | 28 octets | @@ -2179,6 +2180,7 @@ Algorithmes de hachage supportés : [width="100%",cols="4,4,4,5,12",options="header"] |=== | Valeur | Algorithme | Taille du haché | Sortie (chaîne) | Notes +| `+crc32+` | CRC32 | 32 bits | 8 caractères hexa | Pas un algorithme de hachage au sens cryptographique. | `+md5+` | MD5 | 128 bits | 32 caractères hexa | *Faible*, non recommandé pour un usage cryptographique. | `+sha1+` | SHA-1 | 160 bits | 40 caractères hexa | *Faible*, non recommandé pour un usage cryptographique. | `+sha224+` | SHA-224 | 224 bits | 56 caractères hexa | diff --git a/doc/it/weechat_plugin_api.it.adoc b/doc/it/weechat_plugin_api.it.adoc index 45325214f..c21dcfecf 100644 --- a/doc/it/weechat_plugin_api.it.adoc +++ b/doc/it/weechat_plugin_api.it.adoc @@ -2182,6 +2182,7 @@ Supported hash algorithms: [width="100%",cols="4,4,4,5,12",options="header"] |=== | Value | Algorithm | Hash size | Output (binary) | Notes +| `+crc32+` | CRC32 | 32 bits | 4 bytes | Not a hash algorithm in the cryptographic sense. | `+md5+` | MD5 | 128 bits | 16 bytes | *Weak*, not recommended for cryptography usage. | `+sha1+` | SHA-1 | 160 bits | 20 bytes | *Weak*, not recommended for cryptography usage. | `+sha224+` | SHA-224 | 224 bits | 28 bytes | @@ -2234,6 +2235,7 @@ Supported hash algorithms: [width="100%",cols="4,4,4,5,12",options="header"] |=== | Value | Algorithm | Hash size | Output (string) | Notes +| `+crc32+` | CRC32 | 32 bits | 8 hex chars | Not a hash algorithm in the cryptographic sense. | `+md5+` | MD5 | 128 bits | 32 hex chars | *Weak*, not recommended for cryptography usage. | `+sha1+` | SHA-1 | 160 bits | 40 hex chars | *Weak*, not recommended for cryptography usage. | `+sha224+` | SHA-224 | 224 bits | 56 hex chars | diff --git a/doc/ja/weechat_plugin_api.ja.adoc b/doc/ja/weechat_plugin_api.ja.adoc index c8e69621c..8ba2f4aea 100644 --- a/doc/ja/weechat_plugin_api.ja.adoc +++ b/doc/ja/weechat_plugin_api.ja.adoc @@ -2104,6 +2104,7 @@ Supported hash algorithms: [width="100%",cols="4,4,4,5,12",options="header"] |=== | Value | Algorithm | Hash size | Output (binary) | Notes +| `+crc32+` | CRC32 | 32 bits | 4 bytes | Not a hash algorithm in the cryptographic sense. | `+md5+` | MD5 | 128 bits | 16 bytes | *Weak*, not recommended for cryptography usage. | `+sha1+` | SHA-1 | 160 bits | 20 bytes | *Weak*, not recommended for cryptography usage. | `+sha224+` | SHA-224 | 224 bits | 28 bytes | @@ -2156,6 +2157,7 @@ Supported hash algorithms: [width="100%",cols="4,4,4,5,12",options="header"] |=== | Value | Algorithm | Hash size | Output (string) | Notes +| `+crc32+` | CRC32 | 32 bits | 8 hex chars | Not a hash algorithm in the cryptographic sense. | `+md5+` | MD5 | 128 bits | 32 hex chars | *Weak*, not recommended for cryptography usage. | `+sha1+` | SHA-1 | 160 bits | 40 hex chars | *Weak*, not recommended for cryptography usage. | `+sha224+` | SHA-224 | 224 bits | 56 hex chars | diff --git a/src/core/wee-string.c b/src/core/wee-string.c index 71154f631..ac10b3fb7 100644 --- a/src/core/wee-string.c +++ b/src/core/wee-string.c @@ -66,6 +66,7 @@ c - '0') char *string_hash_algo_string[] = { + "crc32", "md5", "sha1", "sha224", "sha256", "sha384", "sha512", @@ -73,6 +74,7 @@ char *string_hash_algo_string[] = { NULL, }; int string_hash_algo[] = { + GCRY_MD_CRC32, GCRY_MD_MD5, GCRY_MD_SHA1, GCRY_MD_SHA224, GCRY_MD_SHA256, GCRY_MD_SHA384, GCRY_MD_SHA512, diff --git a/tests/unit/core/test-core-secure.cpp b/tests/unit/core/test-core-secure.cpp index 2fe178b44..1ae802fe9 100644 --- a/tests/unit/core/test-core-secure.cpp +++ b/tests/unit/core/test-core-secure.cpp @@ -120,6 +120,9 @@ TEST(CoreSecure, Hash) WEE_CHECK_HASH_BIN(NULL, "test", 0, 0); WEE_CHECK_HASH_HEX(NULL, "test", 0, 0); + WEE_CHECK_HASH_BIN(DATA_HASH_CRC32, data, length, GCRY_MD_CRC32); + WEE_CHECK_HASH_HEX(DATA_HASH_CRC32, data, length, GCRY_MD_CRC32); + WEE_CHECK_HASH_BIN(DATA_HASH_MD5, data, length, GCRY_MD_MD5); WEE_CHECK_HASH_HEX(DATA_HASH_MD5, data, length, GCRY_MD_MD5); diff --git a/tests/unit/core/test-core-string.cpp b/tests/unit/core/test-core-string.cpp index 0c39e5204..b6d148dbb 100644 --- a/tests/unit/core/test-core-string.cpp +++ b/tests/unit/core/test-core-string.cpp @@ -1978,6 +1978,9 @@ TEST(CoreString, Hash) WEE_CHECK_HASH_BIN(NULL, DATA_HASH, length, "not_an_algo"); WEE_CHECK_HASH_HEX(NULL, DATA_HASH, length, "not_an_algo"); + WEE_CHECK_HASH_BIN(DATA_HASH_CRC32, data, length, "crc32"); + WEE_CHECK_HASH_HEX(DATA_HASH_CRC32, data, length, "crc32"); + WEE_CHECK_HASH_BIN(DATA_HASH_MD5, data, length, "md5"); WEE_CHECK_HASH_HEX(DATA_HASH_MD5, data, length, "md5"); diff --git a/tests/unit/core/test-core.h b/tests/unit/core/test-core.h index ace1e55aa..edf5bc35f 100644 --- a/tests/unit/core/test-core.h +++ b/tests/unit/core/test-core.h @@ -21,6 +21,7 @@ #define WEECHAT_TEST_UNIT_CORE_H #define DATA_HASH "this is a test of hash function" +#define DATA_HASH_CRC32 "ef26fe3e" #define DATA_HASH_MD5 "1197d121af621ac6a63cb8ef6b5dfa30" #define DATA_HASH_SHA1 "799d818061175b400dc5aaeb14b8d32cdef32ff0" #define DATA_HASH_SHA224 "637d21f3ba3f4e9fa9fb889dc990b31a658cb37b4aefb5144" \ |