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
64490897
Commit
64490897
authored
Mar 16, 2015
by
Felix Lange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypto: add Sha3Hash
parent
e620bde4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
crypto.go
crypto/crypto.go
+10
-1
No files found.
crypto/crypto.go
View file @
64490897
...
...
@@ -16,10 +16,10 @@ import (
"errors"
"code.google.com/p/go-uuid/uuid"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto/ecies"
"github.com/ethereum/go-ethereum/crypto/secp256k1"
"github.com/ethereum/go-ethereum/crypto/sha3"
"github.com/ethereum/go-ethereum/common"
"golang.org/x/crypto/pbkdf2"
"golang.org/x/crypto/ripemd160"
)
...
...
@@ -37,6 +37,15 @@ func Sha3(data ...[]byte) []byte {
return
d
.
Sum
(
nil
)
}
func
Sha3Hash
(
data
...
[]
byte
)
(
h
common
.
Hash
)
{
d
:=
sha3
.
NewKeccak256
()
for
_
,
b
:=
range
data
{
d
.
Write
(
b
)
}
d
.
Sum
(
h
[
:
])
return
h
}
// Creates an ethereum address given the bytes and the nonce
func
CreateAddress
(
b
[]
byte
,
nonce
uint64
)
[]
byte
{
return
Sha3
(
common
.
NewValue
([]
interface
{}{
b
,
nonce
})
.
Encode
())[
12
:
]
...
...
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