Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corrected mnemonic namespaces #131

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
243 changes: 243 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please leave .gitignore out of this PR? Thanks!

# Created by https://www.toptal.com/developers/gitignore/api/linux,macos,dotenv,laravel,windows,composer,intellij,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=linux,macos,dotenv,laravel,windows,composer,intellij,visualstudiocode

### Composer ###
composer.phar
/vendor/

# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
composer.lock

### dotenv ###
.env

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/

# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml

# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/

# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$

# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml

### Laravel ###
node_modules/
npm-debug.log
yarn-error.log

# Laravel 4 specific
bootstrap/compiled.php
app/storage/

# Laravel 5 & Lumen specific
public/storage
public/hot

# Laravel 5 & Lumen specific with changed public path
public_html/storage
public_html/hot

storage/*.key
Homestead.yaml
Homestead.json
/.vagrant
.phpunit.result.cache

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# Support for Project snippet scope

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.toptal.com/developers/gitignore/api/linux,macos,dotenv,laravel,windows,composer,intellij,visualstudiocode

/.php-version

!.gitkeep
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"
];
}
}
}
Loading