This file contains hidden or 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
    
  
  
    
  | // -- Cargo.toml -- | |
| // [dependencies] | |
| // rand = { version = "0.8.5" } | |
| // const-hex = { version = "1.13.1" } | |
| use rand::prelude::*; | |
| // Tamanho do secret e do vetor de inicialização. | |
| const BLOCK_SIZE: usize = 16; | |
| #[allow(clippy::manual_memcpy)] | 
  
    
      This file contains hidden or 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
    
  
  
    
  | const fn modpow(g: u32, exp: u128, n: u32) -> u32 { | |
| let mut exponente = exp; | |
| let mut resultado = 1; | |
| let mut double = g; | |
| while exponente > 0 { | |
| if exponente % 2 == 1 { | |
| resultado *= double; | |
| resultado %= n; | |
| } | |
| exponente /= 2; | 
  
    
      This file contains hidden or 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
    
  
  
    
  | // Author: Lohann Paterno Coutinho Ferreira | |
| // | |
| use num_bigint::BigUint; // ^0.4.6 | |
| use num_traits::{One, Zero}; // ^0.2.19 | |
| use num_integer::Integer; // ^0.1.46 | |
| #[allow(clippy::unwrap_used, clippy::cast_possible_truncation)] | |
| fn main() { | |
| /// Decimal precision used when printing float and rational values. | |
| const PRECISION: u32 = 32; | 
  
    
      This file contains hidden or 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
    
  
  
    
  | // EVM Interpreter Written in pure EVM assembly | |
| // | |
| // The bytecode is provided in the calldata, the code is interpreted, not deployed as a smart-contract. | |
| // | |
| // Motivation: Deploying a smart-contract is expensive, what if you just want to execute a tiny piece of | |
| // custom logic, but without having to deploy a smart-contract? Then you can use this interpreter with delegatecall. | |
| // Tested on https://www.evm.codes/playground | |
| // | |
| // @author Lohann Paterno Coutinho Ferreira | |
| JUMPDEST // STOP 0x00 | 
  
    
      This file contains hidden or 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: GPL-3.0 | |
| pragma solidity >=0.7.0 <0.9.0; | |
| /** | |
| * Workaround example on how to inject and execute arbitrary bytecode in solidity contract | |
| * Currently only YUL supports verbatim: https://github.com/ethereum/solidity/issues/12067 | |
| * But you cannot import Solidity code in YUL, or YUL code in solidity, so this workaround is necessary. | |
| * It works as long the byte sequence `0x7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F00` appear in the runtime code. | |
| * | 
  
    
      This file contains hidden or 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
    
  
  
    
  | // Efficient SQRT method | |
| // Constant gas cost of 331 discounting RETURN and CALLDATALOAD logic, or 349 including everything. | |
| // | |
| // Special thanks to @caironeth for have found a better log2(x) here: | |
| // - https://github.com/Lohann/openzeppelin-contracts/pull/1 | |
| // | |
| // For testing use this tool: https://www.evm.codes/playground?fork=cancun | |
| // Authors: | |
| // - Lohann Paterno Coutinho Ferreira <[email protected]> | |
| // - Cairo <https://github.com/cairoeth> | 
  
    
      This file contains hidden or 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
    
  
  
    
  | """ | |
| -- requirements.txt | |
| bip_utils==2.9.1 | |
| mnemonic==0.21 | |
| """ | |
| from mnemonic import Mnemonic | |
| from bip_utils import Bip44, Bip44Changes, Bip44Coins | |
| mnemonic = "bottom drive obey lake curtain smoke basket hold race lonely fit walk" | |
| passphrase = "password here" | 
  
    
      This file contains hidden or 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 hashlib | |
| from random import SystemRandom | |
| from collections import namedtuple | |
| ''' | |
| FROST: Flexible Round-Optimized Schnorr Threshold Signatures | |
| Implementation based in this paper: | |
| https://eprint.iacr.org/2020/852.pdf | |
| ''' | 
  
    
      This file contains hidden or 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
    
  
  
    
  | // [dependencies] | |
| // blake2b_simd = "1.0.1" | |
| // num-bigint = "0.4.3" | |
| // num-integer = "0.1.45" | |
| // num-prime = { version = "0.4.3", features=["num-bigint"] } | |
| // num-traits = "0.2.15" | |
| use blake2b_simd; | |
| use num_bigint::{BigInt, BigUint, Sign}; | |
| use num_integer::Integer; | 
  
    
      This file contains hidden or 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
    
  
  
    
  | // "dependencies": { | |
| // "axios": "^1.3.6" | |
| // } | |
| const axios = require('axios'); | |
| const CLIENT_ID = '<client_id_aqui>'; | |
| async function run(token) { | |
| console.log(token); | |
| } |