Instantly share code, notes, and snippets.

View BLS.sol
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)
View BailliePSW.sol
contract BailliePSW {
function sprp(uint a) pure returns (bool iscomposite) {
function modexp() constant returns (bytes32 o){
assembly {
let m := mload(0x40)
mstore(add(m, 0x20),2)
View FlipEndian.sol
pragma solidity ^0.4.19;
contract FlipEndian {
function flip32_1(bytes32 a) public constant returns (bytes32 b){
assembly {
and(div(a, 0x100000000000000000000000000000000000000000000000000000000000000), 0xFF)
and(div(a, 0x10000000000000000000000000000000000000000000000000000000000), 0xFF00)
View log2.sol
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 ( on keybase.
  • I have a public key ASDR9HNQsRzpOcLNM6uc4IPWn_ljtln2BCEpx78JBwhNiAo

To claim this, I am signing this object:

View MultiProxy.sol
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 {
View multiply.cpp
#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;
View disasm.js
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) {