Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
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
俞永鹏
openzeppelin-contracts-upgradeable
Commits
a65b2bc6
Commit
a65b2bc6
authored
Dec 21, 2021
by
github-actions
Browse files
Options
Browse Files
Download
Plain Diff
Merge upstream master into patched/master
parents
6c0f31c6
cafd900a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
MerkleProof.sol
contracts/utils/cryptography/MerkleProof.sol
+10
-2
No files found.
contracts/utils/cryptography/MerkleProof.sol
View file @
a65b2bc6
...
...
@@ -41,12 +41,20 @@ library MerkleProof {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash =
keccak256(abi.encodePacked(computedHash, proofElement)
);
computedHash =
_efficientHash(computedHash, proofElement
);
} else {
// Hash(current element of the proof + current computed hash)
computedHash =
keccak256(abi.encodePacked(proofElement, computedHash)
);
computedHash =
_efficientHash(proofElement, computedHash
);
}
}
return computedHash;
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
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