Skip to content

Instantly share code, notes, and snippets.

View tjade273's full-sized avatar

Tjaden Hess tjade273

View GitHub Profile
@tjade273
tjade273 / BLS.sol
Created March 8, 2018 18:42 — forked from anonymous/BLS.sol
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.21+commit.dfe3193c.js&optimize=false&gist=
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)
@tjade273
tjade273 / BailliePSW.sol
Created February 14, 2018 03:22 — forked from anonymous/BailliePSW.sol
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.19+commit.c4cbbb05.js&optimize=false&gist=
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)
@tjade273
tjade273 / FlipEndian.sol
Created January 17, 2018 21:06 — forked from anonymous/FlipEndian.sol
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.19+commit.c4cbbb05.js&optimize=false&gist=
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
0xCdEF3fC9F3fC928447c32F3e9002b9a02aAbB47A
function log2(uint x) returns (uint y){
assembly {
let arg := x
x := sub(x,1)
x := or(x, div(x, 0x02))
x := or(x, div(x, 0x04))
x := or(x, div(x, 0x10))
x := or(x, div(x, 0x100))
x := or(x, div(x, 0x10000))
x := or(x, div(x, 0x100000000))

Keybase proof

I hereby claim:

  • I am tjade273 on github.
  • I am tjade273 (https://keybase.io/tjade273) on keybase.
  • I have a public key ASDR9HNQsRzpOcLNM6uc4IPWn_ljtln2BCEpx78JBwhNiAo

To claim this, I am signing this object:

0x6384f6b34b7f14a551fe2d94e21ac79637eded25
contract MultiProxy{
//Data schema: [from: 32 bytes, to: 32 bytes, value: 32 bytes, data_length: 32 bytes, data: data_length bytes]
function forward(bytes32[]) external payable {
assembly {
function next_tx (c) -> n {
let data_size := calldataload(add(c, 96))
n := add(c, add(128, mul(div(data_size, 32), 32)))
switch mod(data_size, 32)
case 0 {
#include <gtest/gtest.h>
#include <gadgetlib2/gadget.hpp>
#include "gadgetlib2/adapters.hpp"
#include "gadgetlib2/integration.hpp"
#include "relations/constraint_satisfaction_problems/r1cs/examples/r1cs_examples.hpp"
#include "gadgetlib2/examples/simple_example.hpp"
#include "zk_proof_systems/ppzksnark/r1cs_ppzksnark/examples/run_r1cs_ppzksnark.hpp"
using namespace libsnark;
@tjade273
tjade273 / disasm.js
Last active May 3, 2017 14:06 — forked from anonymous/gist:d3bbdc55159879046345
Ethereum OPCODE disassembler
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) {