This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract BLS { | |
uint public nonce; | |
uint[4] public pubkey; | |
// sig[0:1] is h^-x, sig[2] is the y-component of h | |
function forward(uint[3] sig, uint gas, address addr, uint value, bytes data) returns (bool) { | |
bytes32 msg = keccak256(nonce, gas, addr, value, data); | |
bool success; | |
assembly { | |
let m := mload(0x40) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract BailliePSW { | |
function sprp(uint a) pure returns (bool iscomposite) { | |
} | |
function modexp() constant returns (bytes32 o){ | |
assembly { | |
let m := mload(0x40) | |
mstore(m,1) | |
mstore(add(m, 0x20),2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.19; | |
contract FlipEndian { | |
function flip32_1(bytes32 a) public constant returns (bytes32 b){ | |
assembly { | |
0 | |
and(div(a, 0x100000000000000000000000000000000000000000000000000000000000000), 0xFF) | |
or | |
and(div(a, 0x10000000000000000000000000000000000000000000000000000000000), 0xFF00) | |
or |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function disasm(code) { | |
if (!code) | |
return code; | |
var codes = code.match(/(..?)/g); | |
var dis = ""; | |
for(var i = 1; i < codes.length; i++) { | |
var opcode = opcodes[codes[i]]; | |
dis += i+". " + codes[i]+": " | |
if (!opcode) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Base contract that all upgradeable contracts should use. | |
* | |
* Contracts implementing this interface are all called using delegatecall from | |
* a dispatcher. As a result, the _sizes and _dest variables are shared with the | |
* dispatcher contract, which allows the called contract to update these at will. | |
* | |
* _sizes is a map of function signatures to return value sizes. Due to EVM | |
* limitations, these need to be populated by the target contract, so the | |
* dispatcher knows how many bytes of data to return from called functions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract complex{ | |
address add; | |
uint aa; | |
uint bb; | |
function thrower() | |
{ | |
throw; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library ProofLib { | |
struct Proof { | |
address defender; | |
address challenger; | |
bytes32 lVal; | |
bytes32 rVal; | |
uint lIndex; | |
uint rIndex; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library HashLadder{ | |
function genPubKey(bytes32[2][32] privKey) returns (bytes32[2][32]){ | |
bytes32[2][32] memory pubKey; | |
for(uint8 i; i< 32; i++){ | |
bytes32 pa = privKey[i][0]; | |
bytes32 pb = privKey[i][1]; | |
for(uint k; k<258; k++){ | |
pa = sha3(pa); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library HashLadder{ | |
function genPubKey(bytes32[2][32] privKey) returns (bytes32[2][32]){ | |
bytes32[2][32] memory pubKey; | |
for(uint8 i; i< 32; i++){ | |
bytes32 pa = privKey[i][0]; | |
bytes32 pb = privKey[i][1]; | |
for(uint k; k<258; k++){ | |
pa = sha3(pa); | |
pb = sha3(pb); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library LamportVerify{ | |
function getBit(bytes32 data, uint256 index) constant returns(uint8) { // gets bit `i` from data | |
return uint8(uint256(data) / (2**((255-index)))) & 0x01; | |
} | |
function verify_sig(bytes32 msgHash, bytes32[512] pubKey, bytes32[256] signature) returns(bool){ | |
for(uint i; i < 256; i++){ | |
bytes32 pub; |
NewerOlder