Skip to content

Instantly share code, notes, and snippets.

View Hash Ladders for Shorter Lamport

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?

alexwebr / brightness.c
Last active August 29, 2015 14:14
Mark this as setuid and put in your path, call with 'up' or 'down' to adjust your laptop's brightness.
View brightness.c
#include <stdio.h>
const char *path = "/sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS6208:00/backlight/toshiba/brightness";
int main(int argc, char *argv[])
if (argc != 2) {
fputs("Need exactly one argument", stderr);
return 1;
alexwebr / dust_in_the_wind.rb
Created July 2, 2015 21:58
View dust_in_the_wind.rb
# Iterates through its elements, starting at the beginning, forever.
class CircularList
def initialize values
@values = values
@index = 0
def next
value = @values[@index]
@index += 1
alexwebr / gist:8347140
Last active January 2, 2016 18:59
Recursively frees a singly-linked tree structure (each node has a child, a first sibling, or both)
View gist:8347140
// [... snip ...]
void free_tree(tree_t *p)
if (p->sibling != NULL) {
p->sibling = NULL;
if (p->child != NULL) {
alexwebr / bad_strncpy.c
Last active May 11, 2016 16:41
Bad use of strncpy()
View bad_strncpy.c
#include <string.h>
#include <stdio.h>
#include <assert.h>
// Find this with:
// git grep 'strncpy(\([^,]\+\), [^,]\+, sizeof(\1));'
int main(int argc, char *argv[])
// Take a single string argument
View better_vimdiff.vim
hi DiffAdd ctermfg=7 ctermbg=4
hi DiffChange ctermfg=7 ctermbg=4
hi DiffDelete ctermfg=7 ctermbg=4
hi DiffText ctermfg=7 ctermbg=1