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
a68eaa4e
Commit
a68eaa4e
authored
Jul 02, 2017
by
AugustoL
Committed by
Francisco Giordano
Jul 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added NatSpec documentation on ECRecovery contract
parent
68c2bcb9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
ECRecovery.sol
contracts/ECRecovery.sol
+17
-4
No files found.
contracts/ECRecovery.sol
View file @
a68eaa4e
...
@@ -2,12 +2,20 @@ pragma solidity ^0.4.11;
...
@@ -2,12 +2,20 @@ pragma solidity ^0.4.11;
/**
/**
* Eliptic curve signature operations
* @title Eliptic curve signature operations
* Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d
*
*/
* @dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d
*/
library ECRecovery {
library ECRecovery {
// Duplicate Solidity's ecrecover, but catching the CALL return value
/**
* @dev Duplicate Solidity's ecrecover, but catching the CALL return value
* @param hash bytes32 messahe hash from which the signature will be recovered
* @param v uint8 signature version
* @param r bytes32 signature r value
* @param s bytes32 signature s value
*/
function safeRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) constant returns (bool, address) {
function safeRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) constant returns (bool, address) {
// We do our own memory management here. Solidity uses memory offset
// We do our own memory management here. Solidity uses memory offset
// 0x40 to store the current end of memory. We write past it (as
// 0x40 to store the current end of memory. We write past it (as
...
@@ -34,6 +42,11 @@ library ECRecovery {
...
@@ -34,6 +42,11 @@ library ECRecovery {
return (ret, addr);
return (ret, addr);
}
}
/**
* @dev Recover signer address from a message by using his signature
* @param hash bytes32 messahe hash from which the signature will be recovered
* @param sig bytes signature
*/
function recover(bytes32 hash, bytes sig) constant returns (address) {
function recover(bytes32 hash, bytes sig) constant returns (address) {
bytes32 r;
bytes32 r;
bytes32 s;
bytes32 s;
...
...
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