Skip to content
Verified contractPartial

Test

Address0x999a4d292015046dee596ed744e4147f42c2b5bb
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.1.6

 

Same code

Only this contract

 

Details

Compiler
solc 0.1.6+commit.d41f8b7c
Language
solidity
Optimization
Yes, 200 runs
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
508,223
Creation transaction
0xbe13ce07d2…8d09abe922

Test.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
contract Test {
    address owner;

    function Test() {
        owner = msg.sender;
    }

    function testSigner() returns (address) {
        return 0x31031df1d95a84fc21e80922ccdf83971f3e755b;
    }

    function v() returns (uint8) {
        return 32;
    }

    function v2() returns (uint8) {
        return 28;
    }

    function hashToSign() returns (bytes32) {
        return parseBytes32("58e2f335bbd6f2b0da93eae19342e7309654fbfeed9a214a1e5d835ac09cc226");
    }

    function priv() returns (bytes32) {
        return parseBytes32("eab5f6141b4c66877f178f8b87c804d380af6d5404edc249d2c388dbcc542977");
    }

    function r() returns (bytes32) {
        return parseBytes32("0b7effb7704f726bc64139753dc2d0a3929af2309dd2930ad7a722f5b214cf6e");
    }

    function s() returns (bytes32) {
        return parseBytes32("73a461ce418e9e483f13a98c0cba5cddf07f647ea1d6ba2e88d494dfcd411c9c");
    }

    function parseAddress() returns (address) {
        return parseAddr("31031df1d95a84fc21e80922ccdf83971f3e755b");
    }

    function parseByte() returns (uint8) {
        return parseByte("20");
    }

    function ecrecover(bytes32 h, uint8 v, bytes32 r, bytes32 s) returns (address) {
        return ecrecover(h, v, r, s);
    }

    function verify2() returns (address) {
        return ecrecover(hashToSign(), v2(), r(), s());
    }

    function isValidSignature(address signer, bytes32 h, uint8 v, bytes32 r, bytes32 s) returns (uint8) {
        address a = ecrecover(h, v, r, s);
        if (a == signer) return 1;
        else return 0;
    }

    function isValidSignature(address signer, string hash, string vs, string rs, string ss) returns (uint8) {
        bytes32 h = parseBytes32(hash);
        uint8 v = parseByte(vs);
        bytes32 r = parseBytes32(rs);
        bytes32 s = parseBytes32(ss);
        address a = ecrecover(h, v, r, s);
        if (a == signer) return 1;
        else return 0;
    }

    function verifyTest() returns (uint8) {
        uint8 ok = isValidSignature(0x31031df1d95a84fc21e80922ccdf83971f3e755b, "58e2f335bbd6f2b0da93eae19342e7309654fbfeed9a214a1e5d835ac09cc226", "1b", "0b7effb7704f726bc64139753dc2d0a3929af2309dd2930ad7a722f5b214cf6e", "73a461ce418e9e483f13a98c0cba5cddf07f647ea1d6ba2e88d494dfcd411c9c");
        return ok;
    }

    function parseBytes32(string _a) returns (bytes32) {
        bytes memory tmp = bytes(_a);
        uint x = 0;
        for (uint i = 0; i < 32; i++) {
            x = x * 256;
            uint j = i * 2;
            uint8 b1 = uint8(tmp[j]);
            uint8 b2 = uint8(tmp[j + 1]);
            if ((b1 >= 97) && (b1 <= 102)) b1 -= 87;
            else if ((b1 >= 48) && (b1 <= 57)) b1 -= 48;
            if ((b2 >= 97) && (b2 <= 102)) b2 -= 87;
            else if ((b2 >= 48) && (b2 <= 57)) b2 -= 48;
            x += uint8(b1 * 16 + b2);
        }
        return bytes32(x);
    }

    function parseByte(string _a) returns (uint8) {
        bytes memory tmp = bytes(_a);
        return parseByte(uint8(tmp[0]), uint8(tmp[1]));
    }

    function parseByte(uint8 b1, uint8 b2) returns (uint8) {
        if ((b1 >= 97) && (b1 <= 102)) b1 -= 87;
        else if ((b1 >= 48) && (b1 <= 57)) b1 -= 48;
        if ((b2 >= 97) && (b2 <= 102)) b2 -= 87;
        else if ((b2 >= 48) && (b2 <= 57)) b2 -= 48;
        return b1 * 16 + b2;
    }

    function parseAddr(string _a) returns (address) {
        bytes memory tmp = bytes(_a);
        uint160 iaddr = 0;
        uint160 b1;
        uint160 b2;
        for (uint i = 2; i < 2+2*20; i += 2) {
            iaddr *= 256;
            b1 = uint160(tmp[i]);
            b2 = uint160(tmp[i+1]);
            if ((b1 >= 97) && (b1 <= 102)) b1 -= 87;
            else if ((b1 >= 48) && (b1 <= 57)) b1 -= 48;
            if ((b2 >= 97) && (b2 <= 102)) b2 -= 87;
            else if ((b2 >= 48) && (b2 <= 57)) b2 -= 48;
            iaddr += (b1 * 16 + b2);
        }
        return address(iaddr);
    }

    function kill() {
        if (msg.sender == owner) suicide(msg.sender);
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.