Skip to content

Instantly share code, notes, and snippets.

View cygnusv's full-sized avatar
🐛

David Núñez cygnusv

🐛
View GitHub Profile

Keybase proof

I hereby claim:

  • I am cygnusv on github.
  • I am davidnunez (https://keybase.io/davidnunez) on keybase.
  • I have a public key ASAfgGBypB7xi0zozHmjFMW9c_zt2TfrOy8zH9UQiS62MAo

To claim this, I am signing this object:

diff -u old/big.cpp new/big.cpp
--- old/big.cpp 2016-10-28 03:19:34.000000000 +0200
+++ new/big.cpp 2017-02-03 09:50:04.000000000 +0100
@@ -104,6 +104,19 @@
Big operator>>(const Big& b, int i)
{Big ms; sftbit(b.fn,-i,ms.fn); return ms;}
+BOOL operator<=(const Big& b1,const Big& b2)
+ {if (mr_compare(b1.fn,b2.fn)<=0) return TRUE; else return FALSE;}
+BOOL operator>=(const Big& b1,const Big& b2)
@cygnusv
cygnusv / tate-pairing-example.sage
Created July 6, 2017 10:36
Tate Pairing Example
# Copied from:
# https://raw.githubusercontent.com/guanzhi/CryptoWithSageMath/master/tate-pairing-example.sage
# Tate Pairing Example
# Example 5.43 in IMC
# E: y^2 = x^3 + 30x + 34 mod 631
p = 631
a = 30
b = 34
@cygnusv
cygnusv / umbral-simple-api.py
Last active March 20, 2018 08:50
Basic example of pyUmbral
from umbral import umbral, keys
# Generate umbral keys for Alice.
alices_private_key = keys.UmbralPrivateKey.gen_key()
alices_public_key = private_key.get_pubkey()
# Generate umbral keys for Bob.
bobs_private_key = keys.UmbralPrivateKey.gen_key()
bobs_public_key = private_key.get_pubkey()
(nucypher) david@Macbook [23:03:33]:~/NuCypher/dev/test/nucypher
└─ $ ls -lh /var/folders/9m/cm5wk3gj3nz_skbj_45pvbk80000gn/T/nucypher-temp-cert-0x86*
-rw------- 1 david staff 717B Jan 10 22:31 /var/folders/9m/cm5wk3gj3nz_skbj_45pvbk80000gn/T/nucypher-temp-cert-0x86cF04715Fa28c39A253f85f69eaeE34d2ecd7c3-05ty5ddt.pem
-rw------- 1 david staff 717B Jan 10 22:38 /var/folders/9m/cm5wk3gj3nz_skbj_45pvbk80000gn/T/nucypher-temp-cert-0x86cF04715Fa28c39A253f85f69eaeE34d2ecd7c3-07py6h0_.pem
-rw------- 1 david staff 717B Jan 10 22:25 /var/folders/9m/cm5wk3gj3nz_skbj_45pvbk80000gn/T/nucypher-temp-cert-0x86cF04715Fa28c39A253f85f69eaeE34d2ecd7c3-08yn4nha.pem
-rw------- 1 david staff 717B Jan 10 22:29 /var/folders/9m/cm5wk3gj3nz_skbj_45pvbk80000gn/T/nucypher-temp-cert-0x86cF04715Fa28c39A253f85f69eaeE34d2ecd7c3-08yoodtv.pem
-rw------- 1 david staff 717B Jan 10 22:34 /var/folders/9m/cm5wk3gj3nz_skbj_45pvbk80000gn/T/nucypher-temp-cert-0x86cF04715Fa28c39A253f85f69eaeE34d2ecd7c3-0_u0ou97.pem
-rw------- 1 dav
Stage a new stake? [y/N]: y
Current balance: 1000000000000000000000000000
Enter stake value in NU [15000]: 15000
Minimum duration: 30 | Maximum Duration: 365
Enter stake duration in periods (1 Period = 24 Hours): 30
============================== STAGED STAKE ==============================
(Ursula)⇀Aquamarine Scorpius Coral Queen↽ (0xF59CFb62c66be1dBe0B7b66f2108cb3bFE91667F)
ValueError: when sending a str, it must be a hex string. Got: '608060405234801561001057600080fd5b5060405160c080611cca833981018060405260c081101561003057600080fd5b50805160208201516040808401516060850151608086015160a090960151600080546001600160a01b031916331780825594519697959693959294929391926001600160a01b0316917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a36001600160a01b038616158015906100b557508115155b80156100c057508015155b15156100cb57600080fd5b600480546001600160a01b0319166001600160a01b03881617808255869190600160a01b60ff0219167401000000000000000000000000000000000000000083600281111561011657fe5b02179055506005939093556007556006556008555050611b8f8061013b6000396000f3fe608060405234801561001057600080fd5b50600436106101215760003560e01c80638f32d59b116100ad578063d4b8399211610071578063d4b8399214610835578063e2fdcc171461083d578063e8dccd0614610845578063f2fde38b1461086b578063fc9daa071461089157610121565b80638f32d59b1461032a578063a228580e14610332578063b9626d21146107ff578063bd02b14014610825578063d29e6803146
(nucypher-rz58eSz8) david@nuc [23:01:32]:~/NuCypher/dev/nucypher (HEAD detached at upstream/hawksbeard)
└─ $ nucypher --debug ursula run --geth
_____ __ _________ ______
___ | / /___ ___ ____/____ ____________ /______________
__ |/ /_ / / / / __ / / /__ __ \_ __ \ _ \_ ___/
_ /| / / /_/ // /___ _ /_/ /__ /_/ / / / / __/ /
/_/ |_/ \__,_/ \____/ _\__, / _ .___//_/ /_/\___//_/
/____/ /_/
{
"config": {
"chainId": 5,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0,
"constantinopleFixBlock": 0,
"ByzantiumBlock": 0
},
"difficulty": "0x100",
└─ $ nucypher-deploy allocations --poa --provider file:///Users/david/dev/mi-genesis/geth.ipc --allocation-infile ../allocations.json --deployer-address 0x3B2aBd6e377c64ba203e56009844eEb03ad06b68
WARNING: --no-hw-wallet is enabled.
WARNING: --etherscan is disabled. If you want to see deployed contracts and TXs in your browser, activate --etherscan.
Using contract registry filepath /Users/david/Library/Application Support/nucypher/contract_registry.json
Selected 0x3B2aBd6e377c64ba203e56009844eEb03ad06b68 - Continue? [y/N]: y
Enter password to unlock account 0x3B2aBd6e377c64ba203e56009844eEb03ad06b68:
Deployer ETH balance: 10000010979.999999583119736832
Continue deploying and allocating? [y/N]: y