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
D = -3572 | |
k = 6 | |
q = 447231129305840782240237212949663229744995012174421358105320171206333968505891497257173296273883152751267692209531558911549014331037613855148689298263886841953 | |
# log2(q) 527.025659602 | |
t = 678535529027017531887434617617827405828167042133406771522385895475121806814108 | |
r_torsion = 21888242871839275222246405745257275088696311157297823662689037894645226208583 | |
a4 = 42712243339421257868660507567123354675510133075791388004452184727050960820502924907704571467862154994392063936591279133153055638947148552957928421434686670171 | |
a6 = 131738226030767995270565871104903809777878096841386516668655049559644995686736483226876210759529899795643641377453253635430103115971908064841330245626213375876 | |
point_count = 447231129305840782240237212949663229744995012174421358105320171206333968505891496578637767246865620863833074591704153083381972197630842332762793823142080027846 | |
h = point_count // r_torsion |
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.5.0; | |
contract MillerRabin | |
{ | |
function modexp_rsa2048(uint256[8] memory b, uint256 e) | |
public view returns(uint256[8] memory result) | |
{ | |
bool success; | |
assembly { | |
let freemem := 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
from typing import List, NamedTuple, Tuple, Union | |
from math import ceil, log2 | |
from random import randint | |
from functools import reduce | |
import operator | |
from py_ecc import bn128 as curve | |
""" | |
Implementation of PolyCommit_{DL} from: |
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
#!/usr/bin/env python | |
""" | |
Implements the Poseidon permutation: | |
Starkad and Poseidon: New Hash Functions for Zero Knowledge Proof Systems | |
- Lorenzo Grassi, Daniel Kales, Dmitry Khovratovich, Arnab Roy, Christian Rechberger, and Markus Schofnegger | |
- https://eprint.iacr.org/2019/458.pdf | |
Other implementations: |
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
#!/usr/bin/env python | |
from __future__ import print_function | |
import os | |
import requests | |
import codecs | |
from bs4 import BeautifulSoup | |
ETHERSCAN_URL = 'https://etherscan.io/' |
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
#!/usr/bin/env bash | |
if [[ -z $1 ]]; then | |
>&2 echo "Usage: `basename $0` [N.M|latest]" | |
>&2 echo "" | |
>&2 echo "Example to download v0.7.2:" | |
>&2 echo "" | |
>&2 echo ' $' "`basename $0` 7.2" | |
>&2 echo "" | |
>&2 echo "Example to download latest version:" |
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
/// Conditionally enable a function if they share the same CurveT type | |
/// e.g. template<IsSameCurve<CurveT,OtherType> = 0> | |
template<typename MyCurve, typename OtherType> | |
using IsSameCurve = std::enable_if_t<std::is_same<MyCurve,typename OtherType::CurveT>::value,int>; | |
/// Conditionally enable a function if the are of the same types and curves | |
/// Uses CanonicalSelfT to determine if they're the same general type | |
/// e.g. template<IsSameCurve<CurveT,OtherType> = 0> |
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 once | |
#include <functional> | |
template<typename... ArgsT> | |
struct EventHook; | |
template<typename... ArgsT> |
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
def text2sms(text): | |
pairs = [' ', '!', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz'] | |
mapping = {c:(str(i)*(j+1)) for i,p in enumerate(pairs) for j, c in enumerate(p)} | |
return '-'.join(mapping[c] for c in text if c in mapping) |
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
import re | |
from pypeg2 import word, attr, maybe_some, blank, endl, parse, optional | |
from collections import defaultdict | |
class ExprBase(str): | |
pass | |
class Expression(ExprBase): | |
def __str__(self): | |
return str(self.inside) + ''.join([str(_) for _ in self.rhs]) |