Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/base58.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ class base58
*
* Convert a hexadecimal string to a binary array
*
* @param string $hex A hexadecimal string to convert to a binary array
* @param string $hex A hexadecimal string to convert to a binary array
*
* @return array
*
* @throws Exception
*/
private function hex_to_bin($hex)
private function hex_to_bin($hex): array
{
if (!is_string($hex)) {
throw new Exception('base58->hex_to_bin(): Invalid input type (must be a string)');
Expand Down Expand Up @@ -320,7 +321,7 @@ private function decode_block($data, $buf, $index)
if ($res_size < self::$full_block_size && bcpow(2, 8 * $res_size) <= 0) {
throw new Exception('base58->decode_block(): Integer overflow (bcpow(2, 8 * $res_size) exceeds the maximum 64bit integer)');
}

$tmp_buf = self::uint64_to_8_be($res_num, $res_size);
for ($i = 0, $iMax = count($tmp_buf); $i < $iMax; $i++) {
$buf[$i + $index] = $tmp_buf[$i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace MoneroIntegrations\MoneroPhp\mnemonic;

use MoneroIntegrations\MoneroPhp\wordset;

class chinese_simplified implements wordset {

/* Returns name of wordset in the wordset's native language.
Expand All @@ -12,7 +14,7 @@ static public function name() : string {
return "简体中文 (中国)";
}

/* Returns name of wordset in english.
/* Returns name of wordset in english.
* This is a human-readable string, and should be capitalized
*/
static public function english_name() : string {
Expand All @@ -25,13 +27,13 @@ static public function english_name() : string {
*
* A value of 0 indicates that there is no unique prefix
* and the entire word must be used instead.
*/
*/
static public function prefix_length() : int {
return 1; // first letter of each word in wordset is unique.
}

/* Returns an array of all words in the wordset.
*/
*/
static public function words() : array {
return [
"的",
Expand Down Expand Up @@ -1662,4 +1664,4 @@ static public function words() : array {
"貌",
];
}
}
}
14 changes: 8 additions & 6 deletions src/wordsets/dutch.ws.php → src/mnemonic/dutch.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace MoneroIntegrations\MoneroPhp\mnemonic;

use MoneroIntegrations\MoneroPhp\wordset;

class dutch implements wordset {

/* Returns name of wordset in the wordset's native language.
Expand All @@ -12,7 +14,7 @@ static public function name() : string {
return "Nederlands";
}

/* Returns name of wordset in english.
/* Returns name of wordset in english.
* This is a human-readable string, and should be capitalized
*/
static public function english_name() : string {
Expand All @@ -25,13 +27,13 @@ static public function english_name() : string {
*
* A value of 0 indicates that there is no unique prefix
* and the entire word must be used instead.
*/
*/
static public function prefix_length() : int {
return 4; // first 4 letters of each word in wordset is unique.
}

/* Returns an array of all words in the wordset.
*/
*/
static public function words() : array {
return [
"aalglad",
Expand Down Expand Up @@ -1659,7 +1661,7 @@ static public function words() : array {
"zwepen",
"zwiep",
"zwijmel",
"zworen"
"zworen"
];
}
}
}
14 changes: 8 additions & 6 deletions src/wordsets/english.ws.php → src/mnemonic/english.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace MoneroIntegrations\MoneroPhp\mnemonic;

use MoneroIntegrations\MoneroPhp\wordset;

class english implements wordset {

/* Returns name of wordset in the wordset's native language.
Expand All @@ -12,11 +14,11 @@ static public function name() : string {
return "English";
}

/* Returns name of wordset in english.
/* Returns name of wordset in english.
* This is a human-readable string, and should be capitalized
*/
static public function english_name() : string {
return "English";
return "English";
}

/* Returns integer indicating length of unique prefix,
Expand All @@ -25,13 +27,13 @@ static public function english_name() : string {
*
* A value of 0 indicates that there is no unique prefix
* and the entire word must be used instead.
*/
*/
static public function prefix_length() : int {
return 3; // first 3 letters of each word in wordset is unique.
}

/* Returns an array of all words in the wordset.
*/
*/
static public function words() : array {
return [
"abbey",
Expand Down Expand Up @@ -1662,4 +1664,4 @@ static public function words() : array {
"zoom",
];
}
}
}
12 changes: 7 additions & 5 deletions src/wordsets/english_old.ws.php → src/mnemonic/english_old.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/


use MoneroIntegrations\MoneroPhp\wordset;

class english_old implements wordset {

/* Returns name of wordset in the wordset's native language.
Expand All @@ -17,7 +19,7 @@ static public function name() : string {
return "EnglishOld";
}

/* Returns name of wordset in english.
/* Returns name of wordset in english.
* This is a human-readable string, and should be capitalized
*/
static public function english_name() : string {
Expand All @@ -30,13 +32,13 @@ static public function english_name() : string {
*
* A value of 0 indicates that there is no unique prefix
* and the entire word must be used instead.
*/
*/
static public function prefix_length() : int {
return 0; // require entire word.
}

/* Returns an array of all words in the wordset.
*/
*/
static public function words() : array {
return [
"like",
Expand Down Expand Up @@ -1667,4 +1669,4 @@ static public function words() : array {
"weary",
];
}
}
}
14 changes: 8 additions & 6 deletions src/wordsets/esperanto.ws.php → src/mnemonic/esperanto.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace MoneroIntegrations\MoneroPhp\mnemonic;

use MoneroIntegrations\MoneroPhp\wordset;

class esperanto implements wordset {

/* Returns name of wordset in the wordset's native language.
Expand All @@ -12,7 +14,7 @@ static public function name() : string {
return "Esperanto";
}

/* Returns name of wordset in english.
/* Returns name of wordset in english.
* This is a human-readable string, and should be capitalized
*/
static public function english_name() : string {
Expand All @@ -25,13 +27,13 @@ static public function english_name() : string {
*
* A value of 0 indicates that there is no unique prefix
* and the entire word must be used instead.
*/
*/
static public function prefix_length() : int {
return 4; // first 4 letters of each word in wordset is unique.
}

/* Returns an array of all words in the wordset.
*/
*/
static public function words() : array {
return [
"abako",
Expand Down Expand Up @@ -1659,7 +1661,7 @@ static public function words() : array {
"zoologio",
"zorgi",
"zukino",
"zumilo",
"zumilo",
];
}
}
}
14 changes: 8 additions & 6 deletions src/wordsets/french.ws.php → src/mnemonic/french.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@

namespace MoneroIntegrations\MoneroPhp\mnemonic;

use MoneroIntegrations\MoneroPhp\wordset;

class french implements wordset {

/* Returns name of wordset in the wordset's native language.
* This is a human-readable string, and should be capitalized
* if the language supports it.
*/
static public function name() : string {
return "Français";
return "Français";
}

/* Returns name of wordset in english.
/* Returns name of wordset in english.
* This is a human-readable string, and should be capitalized
*/
static public function english_name() : string {
Expand All @@ -25,13 +27,13 @@ static public function english_name() : string {
*
* A value of 0 indicates that there is no unique prefix
* and the entire word must be used instead.
*/
*/
static public function prefix_length() : int {
return 4; // first 4 letters of each word in wordset is unique.
}

/* Returns an array of all words in the wordset.
*/
*/
static public function words() : array {
return [
"abandon",
Expand Down Expand Up @@ -1662,4 +1664,4 @@ static public function words() : array {
"zoom",
];
}
}
}
16 changes: 9 additions & 7 deletions src/wordsets/german.ws.php → src/mnemonic/german.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@

namespace MoneroIntegrations\MoneroPhp\mnemonic;

use MoneroIntegrations\MoneroPhp\wordset;

class german implements wordset {

/* Returns name of wordset in the wordset's native language.
* This is a human-readable string, and should be capitalized
* if the language supports it.
*/
static public function name() : string {
return "Deutsch";
return "Deutsch";
}

/* Returns name of wordset in english.
/* Returns name of wordset in english.
* This is a human-readable string, and should be capitalized
*/
static public function english_name() : string {
Expand All @@ -26,13 +28,13 @@ static public function english_name() : string {
*
* A value of 0 indicates that there is no unique prefix
* and the entire word must be used instead.
*/
*/
static public function prefix_length() : int {
return 4; // first 4 letters of each word in wordset is unique.
}

/* Returns an array of all words in the wordset.
*/
*/
static public function words() : array {
return [
"Abakus",
Expand Down Expand Up @@ -1660,7 +1662,7 @@ static public function words() : array {
"Zugvogel",
"Zündung",
"Zweck",
"Zyklop"
"Zyklop"
];
}
}
}
14 changes: 8 additions & 6 deletions src/wordsets/italian.ws.php → src/mnemonic/italian.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace MoneroIntegrations\MoneroPhp\mnemonic;

use MoneroIntegrations\MoneroPhp\wordset;

class italian implements wordset {

/* Returns name of wordset in the wordset's native language.
Expand All @@ -12,7 +14,7 @@ static public function name() : string {
return "Italiano";
}

/* Returns name of wordset in english.
/* Returns name of wordset in english.
* This is a human-readable string, and should be capitalized
*/
static public function english_name() : string {
Expand All @@ -25,13 +27,13 @@ static public function english_name() : string {
*
* A value of 0 indicates that there is no unique prefix
* and the entire word must be used instead.
*/
*/
static public function prefix_length() : int {
return 4; // first 4 letters of each word in wordset is unique.
}

/* Returns an array of all words in the wordset.
*/
*/
static public function words() : array {
return [
"abbinare",
Expand Down Expand Up @@ -1659,7 +1661,7 @@ static public function words() : array {
"zoccolo",
"zolfo",
"zombie",
"zucchero"
"zucchero"
];
}
}
}
Loading