Skip to content

Instantly share code, notes, and snippets.

View ph4r05's full-sized avatar
🎯
Focusing

Dušan Klinec ph4r05

🎯
Focusing
View GitHub Profile

SAS: Succinct Atomic Swap

Works today with [single signer ECDSA adaptor signatures][0], or with Schnorr + MuSig.
Other than the explanation below, there's also a diagram and a video.

 
Advantages:

  • Requires merely two on-chain transactions for successful completion, as opposed to four
  • Scriptless, and one of the chains doesn't need to support timelocks
  • Can be used for efficient privacy swaps, e.g. [Payswap][1]
@RealEnder
RealEnder / TWC.py
Created May 4, 2018 04:25
TWC algo
#!/usr/bin/python
import sys
if len(sys.argv) != 3 or len(sys.argv[1]) not in [12,17]:
print 'TWC WPA-PSK generator (c) 2015, 2017 v0.2 by Alex Stanev <alex@stanev.org>'
print 'Usage: '+sys.argv[0]+' [BSSID] [SSID]'
exit(1)
# SSIDs
# Taken from https://www.exploit-db.com/docs/english/38082-compromising-isp-issued-802.11-wireless-cable-modem-networks-for-profit.pdf
@hannob
hannob / infineon-roca.md
Last active October 25, 2020 15:55
Affected Products and Keys by Infineon RSA vulnerability
@truemongo
truemongo / gist:7aea60f80f6aa9b79cc9509b633557c9
Last active October 20, 2017 06:55
Infineon TPM fake buggy key generator
#!/usr/bin/python2
from random import randint, choice
from gmpy2 import is_prime # pip install gmpy2
import operator
### Code from ROCA
primes = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101,
103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167]
prints = [6, 30, 126, 1026, 5658, 107286, 199410, 8388606, 536870910, 2147483646, 67109890, 2199023255550,
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active May 10, 2024 14:19
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.
/*
* CVE-2016-5195 dirtypoc
*
* This PoC is memory only and doesn't write anything on the filesystem.
* /!\ Beware, it triggers a kernel crash a few minutes.
*
* gcc -Wall -o dirtycow-mem dirtycow-mem.c -ldl -lpthread
*/
#define _GNU_SOURCE
@andymatuschak
andymatuschak / States-v3.md
Last active May 1, 2024 12:32
A composable pattern for pure state machines with effects (draft v3)

A composable pattern for pure state machines with effects

State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?

There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.

Here I present a composable pattern for pure state machiness with effects,

@akurani
akurani / zim-wiki-mac-osx-app.md
Last active February 19, 2019 19:13
Create a Mac app for Zim Wiki.
@sivel
sivel / paramiko-keyscan.py
Created May 19, 2015 18:58
Python Paramiko Keyscan
import paramiko
# provide host and port variables
t = paramiko.transport.Transport('%s:%s' % (host, port))
t.start_client()
key = t.get_remote_server_key()
if int(port) != 22:
host = '[%s]:%s' % (host, port)
@imneme
imneme / randutils.hpp
Last active March 28, 2024 20:43
Addresses common issues with C++11 random number generation; makes good seeding easier, and makes using RNGs easy while retaining all the power.
/*
* Random-Number Utilities (randutil)
* Addresses common issues with C++11 random number generation.
* Makes good seeding easier, and makes using RNGs easy while retaining
* all the power.
*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 Melissa E. O'Neill
*