Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
35a82f8f
Commit
35a82f8f
authored
11 years ago
by
Maran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for mneomnic privkeys
parent
782910ea
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1760 additions
and
0 deletions
+1760
-0
mnemonic.go
ethutil/mnemonic.go
+1686
-0
mnemonic_test.go
ethutil/mnemonic_test.go
+74
-0
No files found.
ethutil/mnemonic.go
0 → 100644
View file @
35a82f8f
This diff is collapsed.
Click to expand it.
ethutil/mnemonic_test.go
0 → 100644
View file @
35a82f8f
package
ethutil
import
(
"testing"
)
func
TestMnDecode
(
t
*
testing
.
T
)
{
words
:=
[]
string
{
"ink"
,
"balance"
,
"gain"
,
"fear"
,
"happen"
,
"melt"
,
"mom"
,
"surface"
,
"stir"
,
"bottle"
,
"unseen"
,
"expression"
,
"important"
,
"curl"
,
"grant"
,
"fairy"
,
"across"
,
"back"
,
"figure"
,
"breast"
,
"nobody"
,
"scratch"
,
"worry"
,
"yesterday"
,
}
encode
:=
"c61d43dc5bb7a4e754d111dae8105b6f25356492df5e50ecb33b858d94f8c338"
result
:=
MnemonicDecode
(
words
)
if
encode
!=
result
{
t
.
Error
(
"We expected"
,
encode
,
"got"
,
result
,
"instead"
)
}
}
func
TestMnEncode
(
t
*
testing
.
T
)
{
encode
:=
"c61d43dc5bb7a4e754d111dae8105b6f25356492df5e50ecb33b858d94f8c338"
result
:=
[]
string
{
"ink"
,
"balance"
,
"gain"
,
"fear"
,
"happen"
,
"melt"
,
"mom"
,
"surface"
,
"stir"
,
"bottle"
,
"unseen"
,
"expression"
,
"important"
,
"curl"
,
"grant"
,
"fairy"
,
"across"
,
"back"
,
"figure"
,
"breast"
,
"nobody"
,
"scratch"
,
"worry"
,
"yesterday"
,
}
words
:=
MnemonicEncode
(
encode
)
for
i
,
word
:=
range
words
{
if
word
!=
result
[
i
]
{
t
.
Error
(
"Mnenonic does not match:"
,
words
,
result
)
}
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment