Skip to content

Commit d868a19

Browse files
committed
Improve parameter names in ext/hash
1 parent 23429b5 commit d868a19

10 files changed

+51
-46
lines changed

ext/hash/hash.stub.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,37 @@
22

33
/** @generate-function-entries */
44

5-
function hash(string $algo, string $data, bool $raw_output = false): string|false {}
5+
function hash(string $algorithm, string $data, bool $binary_output = false): string|false {}
66

7-
function hash_file(string $algo, string $filename, bool $raw_output = false): string|false {}
7+
function hash_file(string $algorithm, string $filename, bool $binary_output = false): string|false {}
88

9-
function hash_hmac(string $algo, string $data, string $key, bool $raw_output = false): string|false {}
9+
function hash_hmac(string $algorithm, string $data, string $key, bool $binary_output = false): string|false {}
1010

11-
function hash_hmac_file(string $algo, string $data, string $key, bool $raw_output = false): string|false {}
11+
function hash_hmac_file(string $algorithm, string $data, string $shared_secret_key, bool $binary_output = false): string|false {}
1212

13-
function hash_init(string $algo, int $options = 0, string $key = ""): HashContext {}
13+
function hash_init(string $algorithm, int $options = 0, string $shared_secret_key = ""): HashContext {}
1414

1515
function hash_update(HashContext $context, string $data): bool {}
1616

1717
/** @param resource $handle */
1818
function hash_update_stream(HashContext $context, $handle, int $length = -1): int {}
1919

20-
/** @param resource $stream_context */
20+
/** @param resource|null $stream_context */
2121
function hash_update_file(HashContext $context, string $filename, $stream_context = null): bool {}
2222

23-
function hash_final(HashContext $context, bool $raw_output = false): string {}
23+
function hash_final(HashContext $context, bool $binary_output = false): string {}
2424

2525
function hash_copy(HashContext $context): HashContext {}
2626

2727
function hash_algos(): array {}
2828

2929
function hash_hmac_algos(): array {}
3030

31-
function hash_pbkdf2(string $algo, string $password, string $salt, int $iterations, int $length = 0, bool $raw_output = false): string {}
31+
function hash_pbkdf2(string $algorithm, string $password, string $salt, int $iterations, int $length = 0, bool $binary_output = false): string {}
3232

3333
function hash_equals(string $known_string, string $user_string): bool {}
3434

35-
function hash_hkdf(string $algo, string $ikm, int $length = 0, string $info = "", string $salt = ""): string {}
35+
function hash_hkdf(string $algorithm, string $input_key_material, int $length = 0, string $info = "", string $salt = ""): string {}
3636

3737
#ifdef PHP_MHASH_BC
3838
function mhash_get_block_size(int $hash): int|false {}

ext/hash/hash_arginfo.h

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 28ec46ceae7550c9a4103c98fd7c20364f078289 */
2+
* Stub hash: 049e0236e726e23141f2c6dae823163418fa4802 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
5-
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
5+
ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0)
66
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
7-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, raw_output, _IS_BOOL, 0, "false")
7+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false")
88
ZEND_END_ARG_INFO()
99

1010
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_file, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
11-
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
11+
ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0)
1212
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
13-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, raw_output, _IS_BOOL, 0, "false")
13+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false")
1414
ZEND_END_ARG_INFO()
1515

1616
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_hmac, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
17-
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
17+
ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0)
1818
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
1919
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
20-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, raw_output, _IS_BOOL, 0, "false")
20+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false")
2121
ZEND_END_ARG_INFO()
2222

23-
#define arginfo_hash_hmac_file arginfo_hash_hmac
23+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_hmac_file, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
24+
ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0)
25+
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
26+
ZEND_ARG_TYPE_INFO(0, shared_secret_key, IS_STRING, 0)
27+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false")
28+
ZEND_END_ARG_INFO()
2429

2530
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_hash_init, 0, 1, HashContext, 0)
26-
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
31+
ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0)
2732
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "0")
28-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, key, IS_STRING, 0, "\"\"")
33+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, shared_secret_key, IS_STRING, 0, "\"\"")
2934
ZEND_END_ARG_INFO()
3035

3136
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_update, 0, 2, _IS_BOOL, 0)
@@ -47,7 +52,7 @@ ZEND_END_ARG_INFO()
4752

4853
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_final, 0, 1, IS_STRING, 0)
4954
ZEND_ARG_OBJ_INFO(0, context, HashContext, 0)
50-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, raw_output, _IS_BOOL, 0, "false")
55+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false")
5156
ZEND_END_ARG_INFO()
5257

5358
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_hash_copy, 0, 1, HashContext, 0)
@@ -60,12 +65,12 @@ ZEND_END_ARG_INFO()
6065
#define arginfo_hash_hmac_algos arginfo_hash_algos
6166

6267
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_pbkdf2, 0, 4, IS_STRING, 0)
63-
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
68+
ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0)
6469
ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
6570
ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0)
6671
ZEND_ARG_TYPE_INFO(0, iterations, IS_LONG, 0)
6772
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 0, "0")
68-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, raw_output, _IS_BOOL, 0, "false")
73+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary_output, _IS_BOOL, 0, "false")
6974
ZEND_END_ARG_INFO()
7075

7176
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_equals, 0, 2, _IS_BOOL, 0)
@@ -74,8 +79,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_equals, 0, 2, _IS_BOOL, 0)
7479
ZEND_END_ARG_INFO()
7580

7681
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_hkdf, 0, 2, IS_STRING, 0)
77-
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
78-
ZEND_ARG_TYPE_INFO(0, ikm, IS_STRING, 0)
82+
ZEND_ARG_TYPE_INFO(0, algorithm, IS_STRING, 0)
83+
ZEND_ARG_TYPE_INFO(0, input_key_material, IS_STRING, 0)
7984
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 0, "0")
8085
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, info, IS_STRING, 0, "\"\"")
8186
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, salt, IS_STRING, 0, "\"\"")

ext/hash/tests/hash_error.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ try {
1717
*** Testing hash() : error conditions ***
1818

1919
-- Testing hash() function with invalid hash algorithm --
20-
hash(): Argument #1 ($algo) must be a valid hashing algorithm
20+
hash(): Argument #1 ($algorithm) must be a valid hashing algorithm

ext/hash/tests/hash_file_error.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ unlink( $filename );
3434
*** Testing hash_file() : error conditions ***
3535

3636
-- Testing hash_file() function with an unknown algorithm --
37-
hash_file(): Argument #1 ($algo) must be a valid hashing algorithm
37+
hash_file(): Argument #1 ($algorithm) must be a valid hashing algorithm
3838

3939
-- Testing hash_file() function with a non-existent file --
4040

ext/hash/tests/hash_hkdf_edges.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ Length < digestSize: 98b16391063ece
2626
Length % digestSize != 0: 98b16391063ecee006a3ca8ee5776b1e5f
2727
Algo name case-sensitivity: true
2828
Non-crypto algo name case-sensitivity:
29-
[Error] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
29+
[Error] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm

ext/hash/tests/hash_hkdf_error.phpt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ trycatch_dump(
4848
*** Testing hash_hkdf(): error conditions ***
4949

5050
-- Testing hash_hkdf() function with invalid hash algorithm --
51-
[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
51+
[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm
5252

5353
-- Testing hash_hkdf() function with non-cryptographic hash algorithm --
54-
[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
55-
[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
56-
[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
57-
[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
58-
[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
59-
[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
60-
[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
61-
[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
54+
[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm
55+
[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm
56+
[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm
57+
[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm
58+
[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm
59+
[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm
60+
[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm
61+
[ValueError] hash_hkdf(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm
6262

6363
-- Testing hash_hkdf() function with invalid parameters --
6464
[ValueError] hash_hkdf(): Argument #2 ($ikm) cannot be empty

ext/hash/tests/hash_hmac_error.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ catch (\Error $e) {
3232
*** Testing hash_hmac() : error conditions ***
3333

3434
-- Testing hash_hmac() function with invalid hash algorithm --
35-
hash_hmac(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
35+
hash_hmac(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm
3636

3737
-- Testing hash_hmac() function with non-cryptographic hash algorithm --
38-
hash_hmac(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
38+
hash_hmac(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm

ext/hash/tests/hash_hmac_file_error.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ catch (ValueError $e) {
3737
*** Testing hash() : error conditions ***
3838

3939
-- Testing hash_hmac_file() function with invalid hash algorithm --
40-
hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
40+
hash_hmac_file(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm
4141

4242
-- Testing hash_hmac_file() function with non-cryptographic hash algorithm --
43-
hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
43+
hash_hmac_file(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm
4444

4545
-- Testing hash_hmac_file() function with bad path --
4646
hash_hmac_file(): Argument #2 ($data) must not contain any null bytes

ext/hash/tests/hash_init_error.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ catch (\Error $e) {
4141
*** Testing hash_init(): error conditions ***
4242

4343
-- Testing hash_init() function with unknown algorithms --
44-
hash_init(): Argument #1 ($algo) must be a valid hashing algorithm
44+
hash_init(): Argument #1 ($algorithm) must be a valid hashing algorithm
4545

4646
-- Testing hash_init() function with HASH_HMAC and non-cryptographic algorithms --
47-
hash_init(): Argument #1 ($algo) must be a cryptographic hashing algorithm if HMAC is requested
47+
hash_init(): Argument #1 ($algorithm) must be a cryptographic hashing algorithm if HMAC is requested
4848

4949
-- Testing hash_init() function with HASH_HMAC and no key --
50-
hash_init(): Argument #3 ($key) cannot be empty when HMAC is requested
51-
hash_init(): Argument #3 ($key) cannot be empty when HMAC is requested
50+
hash_init(): Argument #3 ($shared_secret_key) cannot be empty when HMAC is requested
51+
hash_init(): Argument #3 ($shared_secret_key) cannot be empty when HMAC is requested

ext/hash/tests/hash_pbkdf2_error.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ catch (\Error $e) {
5656
*** Testing hash_pbkdf2() : error conditions ***
5757

5858
-- Testing hash_pbkdf2() function with invalid hash algorithm --
59-
hash_pbkdf2(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
59+
hash_pbkdf2(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm
6060

6161
-- Testing hash_pbkdf2() function with non-cryptographic hash algorithm --
62-
hash_pbkdf2(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
62+
hash_pbkdf2(): Argument #1 ($algorithm) must be a valid cryptographic hashing algorithm
6363

6464
-- Testing hash_pbkdf2() function with invalid iterations --
6565
hash_pbkdf2(): Argument #4 ($iterations) must be greater than 0

0 commit comments

Comments
 (0)