-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests, and update docs throughout code
- Loading branch information
Showing
6 changed files
with
146 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
secp256k1/tests/secp256k1_nonce_function_bipschnorr_error_algo16_wrong_size.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--TEST-- | ||
secp256k1_nonce_function_bipschnorr returns 0 if algo16 is neither NULL, or a 16 byte string | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded("secp256k1")) print "skip extension not loaded"; | ||
if (!function_exists("secp256k1_schnorrsig_verify")) print "skip no schnorrsig support"; | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
$output = ''; | ||
$msg32 = str_repeat('A', 32); | ||
$key32 = str_repeat('Z', 32); | ||
$algo = NULL; | ||
|
||
$result = secp256k1_nonce_function_bipschnorr($output, $msg32, $key32, $_algo=str_repeat("W", 15), $_data=null, $_attempt=0); | ||
echo $result . PHP_EOL; | ||
$result = secp256k1_nonce_function_bipschnorr($output, $msg32, $key32, $_algo=str_repeat("W", 17), $_data=null, $_attempt=0); | ||
echo $result . PHP_EOL; | ||
$result = secp256k1_nonce_function_bipschnorr($output, $msg32, $key32, $_algo=str_repeat("W", 16), $_data=null, $_attempt=0); | ||
echo $result . PHP_EOL; | ||
?> | ||
--EXPECT-- | ||
0 | ||
0 | ||
1 |
28 changes: 28 additions & 0 deletions
28
secp256k1/tests/secp256k1_nonce_function_bipschnorr_error_data_wrong_size.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--TEST-- | ||
secp256k1_nonce_function_bipschnorr returns 0 if data string length is not 32 | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded("secp256k1")) print "skip extension not loaded"; | ||
if (!function_exists("secp256k1_schnorrsig_verify")) print "skip no schnorrsig support"; | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
$output = ''; | ||
$msg32 = str_repeat('A', 32); | ||
$key32 = str_repeat('Z', 32); | ||
|
||
$result = secp256k1_nonce_function_bipschnorr($output, $msg32, $key32, $_algo=str_repeat("W", 16), $_data=str_repeat("Y", 31), $_attempt=0); | ||
echo $result . PHP_EOL; | ||
|
||
$result = secp256k1_nonce_function_bipschnorr($output, $msg32, $key32, $_algo=str_repeat("W", 16), $_data=str_repeat("Y", 33), $_attempt=0); | ||
echo $result . PHP_EOL; | ||
|
||
$result = secp256k1_nonce_function_bipschnorr($output, $msg32, $key32, $_algo=str_repeat("W", 16), $_data=str_repeat("Y", 32), $_attempt=0); | ||
echo $result . PHP_EOL; | ||
|
||
?> | ||
--EXPECT-- | ||
0 | ||
0 | ||
1 |
27 changes: 27 additions & 0 deletions
27
secp256k1/tests/secp256k1_nonce_function_bipschnorr_error_data_wrong_type.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--TEST-- | ||
secp256k1_nonce_function_bipschnorr returns 0 if data is neither NULL, or a 32 byte string | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded("secp256k1")) print "skip extension not loaded"; | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
$output = ''; | ||
$msg32 = str_repeat('A', 32); | ||
$key32 = str_repeat('Z', 32); | ||
|
||
$result = secp256k1_nonce_function_bipschnorr($output, $msg32, $key32, $_algo=str_repeat("W", 16), new stdClass(), $_attempt=0); | ||
echo $result . PHP_EOL; | ||
|
||
$result = secp256k1_nonce_function_bipschnorr($output, $msg32, $key32, $_algo=str_repeat("W", 16), 1, $_attempt=0); | ||
echo $result . PHP_EOL; | ||
|
||
$result = secp256k1_nonce_function_bipschnorr($output, $msg32, $key32, $_algo=str_repeat("W", 16), [], $_attempt=0); | ||
echo $result . PHP_EOL; | ||
|
||
?> | ||
--EXPECT-- | ||
0 | ||
0 | ||
0 |
2 changes: 1 addition & 1 deletion
2
secp256k1/tests/secp256k1_nonce_function_default_error_data_wrong_size.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
secp256k1/tests/secp256k1_nonce_function_default_error_data_wrong_type.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--TEST-- | ||
secp256k1_nonce_function_default returns 0 if data is neither NULL, or a 32 byte string | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded("secp256k1")) print "skip extension not loaded"; | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
$output = ''; | ||
$msg32 = str_repeat('A', 32); | ||
$key32 = str_repeat('Z', 32); | ||
|
||
$result = secp256k1_nonce_function_default($output, $msg32, $key32, $_algo=str_repeat("W", 16), new stdClass(), $_attempt=0); | ||
echo $result . PHP_EOL; | ||
|
||
$result = secp256k1_nonce_function_default($output, $msg32, $key32, $_algo=str_repeat("W", 16), 1, $_attempt=0); | ||
echo $result . PHP_EOL; | ||
|
||
$result = secp256k1_nonce_function_default($output, $msg32, $key32, $_algo=str_repeat("W", 16), [], $_attempt=0); | ||
echo $result . PHP_EOL; | ||
|
||
?> | ||
--EXPECT-- | ||
0 | ||
0 | ||
0 |