Skip to content

Instantly share code, notes, and snippets.

View weskerfoot's full-sized avatar

Wesley Kerfoot weskerfoot

View GitHub Profile
@samth
samth / problems.md
Last active August 29, 2015 13:57
Reproducing reproduction.
@karlgluck
karlgluck / Hash Ladders for Shorter Lamport Signatures.md
Last active May 10, 2025 01:59
I describe a method for making Lamport signatures take up less space. I haven't seen anyone use hash chains this way before, so I think it's pretty cool.

What's this all about?

Digital cryptography! This is a subject I've been interested in since taking a class with Prof. Fred Schneider back in college. Articles pop up on Hacker News fairly often that pique my interest and this technique is the result of one of them.

Specifically, this is about Lamport signatures. There are many signature algorithms (ECDSA and RSA are the most commonly used) but Lamport signatures are unique because they are formed using a hash function. Many cryptographers believe that this makes them resistant to attacks made possible by quantum computers.

How does a Lamport Signature work?

@weskerfoot
weskerfoot / lsystem.hs
Created October 20, 2012 00:41
L-System
import Control.Monad
data LSymbol = LRule Char | LDeriv String
type Alphabet = [LSymbol]
type Axiom = [LSymbol]
-- a production is a finite mapping of LSymbol -> LSymbol
-- if no production exists for a given LSymbol on the LHS of a Production
@weskerfoot
weskerfoot / sbphi.hs
Created October 17, 2012 23:42
Fun with Stern-Brocot tree
import Control.Monad
import Data.Ratio
data FakeRatio = FakeRatio { numr :: Int, denom :: Int} deriving (Show)
data SBTriple = SBTriple { left :: FakeRatio,
mid :: FakeRatio,
right :: FakeRatio}
data Directions = TLeft | TRight deriving (Show)
@dbp
dbp / gist:3887084
Created October 14, 2012 02:50
impl eq
struct A {n: uint}
impl A: cmp::Eq {
pure fn eq(other: &A) -> bool {
self.n == other.n
}
pure fn ne(other: &A) -> bool {
!self.eq(other)
}
}
@nikolaplejic
nikolaplejic / gist:3654637
Created September 6, 2012 10:36
How to copy/paste your password in PayPal's change password form
PayPal blocks copy/paste actions in their "change password" form,
citing some irrelevant security issues as the reason. That's a
load of crap, and they know it -- disabling copy/paste makes it a
lot harder to use a decent password generator and a lot easier to
screw up your pwd when retyping, especially if it's a long one
(as it should be!).
So, here's the quick'n'dirty way to use an externally generated
password in your PayPal account:
@armornick
armornick / playwav.c
Created August 24, 2012 07:31
Play a sound with SDL2 (no SDL_Mixer)
#include <SDL2/SDL.h>
#define MUS_PATH "Roland-GR-1-Trumpet-C5.wav"
// prototype for our audio callback
// see the implementation for more information
void my_audio_callback(void *userdata, Uint8 *stream, int len);
// variable declarations
static Uint8 *audio_pos; // global pointer to the audio buffer to be played
@sebfisch
sebfisch / gist:2235780
Created March 29, 2012 10:47
Laymans explanation of delimited continuations with examples of using them for exception handling and nondeterministic programming.

Delimited Continuations

Delimited continuations manipulate the control flow of programs. Similar to control structures like conditionals or loops they allow to deviate from a sequential flow of control.

We use exception handling as another example for control flow manipulation and later show how to implement it using delimited continuations. Finally, we show that nondeterminism can also be expressed using delimited continuations.

Exception Handling