Skip to content

Instantly share code, notes, and snippets.

View niftynei's full-sized avatar
🧡
on sabbatical

neil saitug niftynei

🧡
on sabbatical
View GitHub Profile
@jboner
jboner / latency.txt
Last active November 17, 2024 11:32
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
anonymous
anonymous / arch_install
Created November 22, 2012 19:33
arch install
passwd
systemctl enable sshd.service
systemctl start sshd.service
parted -s /dev/sda mklabel gpt
parted -s /dev/sda mkpart "primary" "fat16" "50MB" "60MB"
parted -s /dev/sda mkpart "primary" "ext4" "1%" "99%"
parted -s /dev/sda set 1 bios_grub on
mkfs.ext4 /dev/sda2

Blind Diffie-Hellman Key Exchange (blind ecash)

The goal of this protocol is for Bob to get Alice to perform a Diffie-Hellman key exchange blindly, such that when the unblinded value is returned, Alice recognizes it as her own, but can’t distinguish it from others (i.e. similar to a blind signature).

Alice:
A = a*G
return A

Bob:
Y = hash_to_curve(secret_message)
r = random blinding factor
@RobinLinus
RobinLinus / threshold-encrypted-backup.py
Last active August 28, 2023 11:32
Threshold-encryption for multisig backups. This is a demo to backup the xpubs of a 3-of-5 multisig
#
# This is a scheme to encrypt a backup of a t-of-n Multisig spending script
# such that any combination of t-of-n xpubkeys can recover the missing (n-t) xpubkeys.
#
#
# In this example, we encrypt the 5 xpubkeys of a 3-of-5 Multisig
# and demonstrate how to recover from any 3 xpubkeys the other 2 missing xpubkeys.
#
# The scheme is a simple variation of Shamir's secret sharing.
# It is nicely compact. The encrypted payload is only the size of 2 xpubkeys.
@reardencode
reardencode / proposal.md
Last active November 2, 2023 18:25
Combined CTV+APO to minimal TXHASH+CSFS

Abstract

This proposal is an alternative to [bip119][] and [bip118][], providing the functionality of both proposals with minimal additional overhead in many cases, while clearing certain objections to both, and opening clear upgrade paths.

This is, in essence, an initially constrained version of Russel O'Connor's [OP_TXHASH+OP_CSFS proposal][].