Skip to content

Commit

Permalink
update function in library to internal
Browse files Browse the repository at this point in the history
  • Loading branch information
AmazingAng committed Sep 13, 2022
1 parent 5da5f9e commit 2c04fb4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions 37_Signature/Signature.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ library ECDSA{
* _signature为签名
* _signer为签名地址
*/
function verify(bytes32 _msgHash, bytes memory _signature, address _signer) public pure returns (bool) {
function verify(bytes32 _msgHash, bytes memory _signature, address _signer) internal pure returns (bool) {
return recoverSigner(_msgHash, _signature) == _signer;
}

// @dev 从_msgHash和签名_signature中恢复signer地址
function recoverSigner(bytes32 _msgHash, bytes memory _signature) public pure returns (address){
function recoverSigner(bytes32 _msgHash, bytes memory _signature) internal pure returns (address){
// 检查签名长度,65是标准r,s,v签名的长度
require(_signature.length == 65, "invalid signature length");
bytes32 r;
Expand Down
4 changes: 2 additions & 2 deletions 37_Signature/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ print(f"签名:{signed_message['signature'].hex()}")

```solidity
// @dev 从_msgHash和签名_signature中恢复signer地址
function recoverSigner(bytes32 _msgHash, bytes memory _signature) public pure returns (address){
function recoverSigner(bytes32 _msgHash, bytes memory _signature) internal pure returns (address){
// 检查签名长度,65是标准r,s,v签名的长度
require(_signature.length == 65, "invalid signature length");
bytes32 r;
Expand Down Expand Up @@ -181,7 +181,7 @@ _signature:0x390d704d7ab732ce034203599ee93dd5d3cb0d4d1d7c600ac11726659489773d5
* _signature为签名
* _signer为签名地址
*/
function verify(bytes32 _msgHash, bytes memory _signature, address _signer) public pure returns (bool) {
function verify(bytes32 _msgHash, bytes memory _signature, address _signer) internal pure returns (bool) {
return recoverSigner(_msgHash, _signature) == _signer;
}
```
Expand Down

0 comments on commit 2c04fb4

Please sign in to comment.