View MiMCp.sol
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
// Copyright (c) 2018 HarryR | |
// License: LGPL-3.0+ | |
pragma solidity ^0.5.0; | |
/** | |
* Implements MiMC-p/p over the altBN scalar field used by zkSNARKs | |
* | |
* See: https://eprint.iacr.org/2016/492.pdf | |
* |
View RandomStorage.sol
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract RandomStorage { | |
mapping(bytes32 => bytes32) internal data; | |
event ReadEvent(bytes32 k, bytes32 v); | |
constructor() {} |
View SapphireShuffle.sol
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.18; | |
contract SapphireShuffle { | |
address private constant RANDOM_BYTES = 0x0100000000000000000000000000000000000001; | |
error ErrorGeneratingRandom(); | |
function _random_bytes32() |
View WW.sol
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
// SPDX-License-Identifier: AGPL-3.0-or-later | |
pragma solidity ^0.8.9; | |
contract WW | |
{ | |
event EncryptedResponse(bytes32 nonce, bytes data); | |
event PublicKey(bytes32 x25519_public); | |
struct Coupon { |
View wrose-example.py
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 z3 | |
s = z3.Solver() | |
bvp = 256 | |
bvs = 2**bvp | |
balanceOf_signer = z3.BitVec('balanceOf_signer', bvp) | |
wad = z3.BitVec('wad', bvp) | |
reward = z3.BitVec('reward', bvp) | |
contract_balance = z3.Int('contract_balance') # z3.IntVal((10**18) * 4.48) | |
# Calculate balance of user after performing withdrawal |
View E2Example.sol
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.8.9; | |
contract E2Example | |
{ | |
event EncryptedResponse(bytes32 nonce, bytes data); | |
event DecryptedInput(uint256 a, uint256 b, uint256 c); | |
event PublicKey(bytes32 x); |
View newrelic.php
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
<?php | |
class NewRelic_Error extends Exception {} | |
function NewRelic_Date(DateTime $date) { | |
return $date->format('Y-m-d') . 'T' . $date->format('H:i:s') . 'Z'; | |
} | |
function NewRelic_Metrics2Array(SimpleXMLElement $result) { | |
$return = array(); |
View cocks-pinch-derive-elements.py
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 |
View MillerRabin.sol
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) |
View KZG10.py
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: |
NewerOlder