Skip to content

Instantly share code, notes, and snippets.

View msinkec's full-sized avatar
🤓

Mihael Šinkec msinkec

🤓
View GitHub Profile
@artjomb
artjomb / PairingLibs.md
Last active June 5, 2024 07:54
List of Pairing Libraries

Pairings can be used for all kinds of advanced cryptographic schemes such as Encryption (Identity-based, Attribute-based, Predicate-based, etc.), Signatures, Zero-Knowledge Proofs, etc. It is in no particular order.

Provides multiple types of Elliptic Curve groups with appropriate pairings on top of them. Code repository resides here.

License: LGPL
Language: C
Thesis: On the Implementation of Pairing-Based Cryptography by Ben Lynn (2007)

@aparrish
aparrish / understanding-word-vectors.ipynb
Last active June 9, 2024 16:59
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cgcardona
cgcardona / Escrow.cash
Created August 25, 2019 20:27
Escrow CashScript Contract for blind escrow based on local.bitcoin.com
contract Escrow(
bytes20 sellerPHK, // Hash160 of seller's public key
bytes20 buyerPKH, // Hash160 of buyer's public key
bytes20 arbitratorPKH, // Hash160 of arbitrator's public key
bytes escrowKey // Nonce (just some unimportant random bytes unique per exchange)
) {
function spend(
sig spenderSig,
pubkey spenderPK,
datasig oracleSig,
@deanmlittle
deanmlittle / mapi.md
Last active May 9, 2022 22:42
Why mAPI is shit

A far from exhaustive list of reasons why mAPI is shit

  1. While it's an acceptable bandaid for now, we probably shouldn't just wrap JSON-RPC. It's really slow, and there's no reason to run an HTTP server that accesses another HTTP server. It's pretty silly tbh.
  2. Nobody likes C#. Like, nobody.
  3. You shouldn't have to go and install an entire postgres database in parallel to a mining node (both of which just love to compete with eachother to consume maximum resources) just to offer people different fee rates. If you had to do something like this, SQLite would be a much more lightweight alternative, however in almost all cases, miners will probably want to just run their own mining consoles (like any other kind of API service provider would) where they manage all this stuff themselves, so in reality, a simple JWT with an exp field, a fee field and a signing secret without any kind of user management whatsoever is probably already sufficient. If you have strong opinions to the contrary about thi
@RobinLinus
RobinLinus / cat_ecc.md
Last active June 12, 2024 17:58
OP_CAT Enables Scalar Multiplication for EC Points

OP_CAT Enables Scalar Multiplication for EC Points

CAT can reduce curve point scalar multiplication to a subtraction in the scalar field.

Subtraction of field elements can probably be emulated in less than 250 (?) opcodes. For now, let's assume we had an (emulated) opcode, op_scalar_sub, for subtracting two elements of the scalar field of secp256k1.

Given secp's generator G, we want to compute for some scalar r the point R = rG

That is possible by hacking it into a Schnorr signature (R,s) for the key P = xG = 1G = G