Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
link33
plugin
Commits
3a7e9761
Commit
3a7e9761
authored
Sep 15, 2021
by
mdj33
Committed by
vipwzw
Sep 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mimc hash seed update
parent
62f57dc9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
9 additions
and
7 deletions
+9
-7
testcase.sh
plugin/dapp/mix/cmd/build/testcase.sh
+0
-0
committree.go
plugin/dapp/mix/executor/committree.go
+1
-1
authorize.go
plugin/dapp/mix/types/authorize.go
+1
-1
deposit.go
plugin/dapp/mix/types/deposit.go
+1
-1
mix.go
plugin/dapp/mix/types/mix.go
+2
-0
transferInput.go
plugin/dapp/mix/types/transferInput.go
+1
-1
transferOutput.go
plugin/dapp/mix/types/transferOutput.go
+1
-1
withdraw.go
plugin/dapp/mix/types/withdraw.go
+1
-1
cryptokey.go
plugin/dapp/mix/wallet/cryptokey.go
+1
-1
No files found.
plugin/dapp/mix/cmd/build/testcase.sh
View file @
3a7e9761
This diff is collapsed.
Click to expand it.
plugin/dapp/mix/executor/committree.go
View file @
3a7e9761
...
...
@@ -95,7 +95,7 @@ func getArchiveRoots(db dbm.KV, exec, symbol string, seq uint64) (*mixTy.CommitT
//TODO seed config
func
getNewTree
()
*
merkletree
.
Tree
{
return
merkletree
.
New
(
mimc
.
NewMiMC
(
"seed"
))
return
merkletree
.
New
(
mimc
.
NewMiMC
(
mixTy
.
MimcHashSeed
))
}
func
calcTreeRoot
(
leaves
*
mixTy
.
CommitTreeLeaves
)
[]
byte
{
...
...
plugin/dapp/mix/types/authorize.go
View file @
3a7e9761
...
...
@@ -58,7 +58,7 @@ type AuthorizeCircuit struct {
// Define declares the circuit's constraints
func
(
circuit
*
AuthorizeCircuit
)
Define
(
curveID
ecc
.
ID
,
cs
*
frontend
.
ConstraintSystem
)
error
{
// hash function
h
,
_
:=
mimc
.
NewMiMC
(
"seed"
,
curveID
,
cs
)
h
,
_
:=
mimc
.
NewMiMC
(
MimcHashSeed
,
curveID
,
cs
)
mimc
:=
&
h
mimc
.
Write
(
circuit
.
AuthorizePriKey
)
cs
.
AssertIsEqual
(
circuit
.
AuthorizePubKey
,
mimc
.
Sum
())
...
...
plugin/dapp/mix/types/deposit.go
View file @
3a7e9761
...
...
@@ -19,7 +19,7 @@ type DepositCircuit struct {
func
(
circuit
*
DepositCircuit
)
Define
(
curveID
ecc
.
ID
,
cs
*
frontend
.
ConstraintSystem
)
error
{
// hash function
mimc
,
_
:=
mimc
.
NewMiMC
(
"seed"
,
curveID
,
cs
)
mimc
,
_
:=
mimc
.
NewMiMC
(
MimcHashSeed
,
curveID
,
cs
)
mimc
.
Write
(
circuit
.
ReceiverPubKey
,
circuit
.
ReturnPubKey
,
circuit
.
AuthorizePubKey
,
circuit
.
Amount
,
circuit
.
NoteRandom
)
cs
.
AssertIsEqual
(
circuit
.
NoteHash
,
mimc
.
Sum
())
...
...
plugin/dapp/mix/types/mix.go
View file @
3a7e9761
...
...
@@ -13,6 +13,8 @@ var tlog = log15.New("module", MixX)
const
(
//MaxTreeLeaves = 1024
TreeLevel
=
10
//MimcHashSeed 电路不支持作为公共输入,设为全局常数
MimcHashSeed
=
"19172955941344617222923168298456110557655645809646772800021167670156933290312"
)
// 执行器的日志类型
...
...
plugin/dapp/mix/types/transferInput.go
View file @
3a7e9761
...
...
@@ -69,7 +69,7 @@ func (circuit *TransferInputCircuit) Define(curveID ecc.ID, cs *frontend.Constra
cs
.
AssertIsBoolean
(
circuit
.
AuthorizeFlag
)
// hash function
h
,
_
:=
mimc
.
NewMiMC
(
"seed"
,
curveID
,
cs
)
h
,
_
:=
mimc
.
NewMiMC
(
MimcHashSeed
,
curveID
,
cs
)
mimc
:=
&
h
//verify spend private key
...
...
plugin/dapp/mix/types/transferOutput.go
View file @
3a7e9761
...
...
@@ -26,7 +26,7 @@ type TransferOutputCircuit struct {
// Define declares the circuit's constraints
func
(
circuit
*
TransferOutputCircuit
)
Define
(
curveID
ecc
.
ID
,
cs
*
frontend
.
ConstraintSystem
)
error
{
// hash function
h
,
_
:=
mimc
.
NewMiMC
(
"seed"
,
curveID
,
cs
)
h
,
_
:=
mimc
.
NewMiMC
(
MimcHashSeed
,
curveID
,
cs
)
mimc
:=
&
h
mimc
.
Write
(
circuit
.
ReceiverPubKey
,
circuit
.
ReturnPubKey
,
circuit
.
AuthorizePubKey
,
circuit
.
Amount
,
circuit
.
NoteRandom
)
cs
.
AssertIsEqual
(
circuit
.
NoteHash
,
mimc
.
Sum
())
...
...
plugin/dapp/mix/types/withdraw.go
View file @
3a7e9761
...
...
@@ -64,7 +64,7 @@ func (circuit *WithdrawCircuit) Define(curveID ecc.ID, cs *frontend.ConstraintSy
cs
.
AssertIsBoolean
(
circuit
.
AuthorizeFlag
)
// hash function
h
,
_
:=
mimc
.
NewMiMC
(
"seed"
,
curveID
,
cs
)
h
,
_
:=
mimc
.
NewMiMC
(
MimcHashSeed
,
curveID
,
cs
)
mimc
:=
&
h
mimc
.
Write
(
circuit
.
SpendPriKey
)
targetSpendKey
:=
cs
.
Select
(
circuit
.
SpendFlag
,
circuit
.
ReceiverPubKey
,
circuit
.
ReturnPubKey
)
...
...
plugin/dapp/mix/wallet/cryptokey.go
View file @
3a7e9761
...
...
@@ -140,7 +140,7 @@ func mimcHashByte(params [][]byte) []byte {
}
func
mimcHashCalc
(
sum
[]
byte
)
[]
byte
{
h
:=
mimc
.
NewMiMC
(
"seed"
)
h
:=
mimc
.
NewMiMC
(
mixTy
.
MimcHashSeed
)
h
.
Write
(
sum
)
return
h
.
Sum
(
nil
)
}
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