Skip to content

Instantly share code, notes, and snippets.

View mhanne's full-sized avatar

Marius Hanne mhanne

View GitHub Profile
class Logger
LEVELS = [:debug, :info, :warn, :error, :fatal]
attr_accessor :level
def initialize(name)
@name = name
@level = :info
end
@mhanne
mhanne / Makefile
Last active May 9, 2020 07:02
libotr usage example
all: example
example: example.c
gcc example.c -lotr -o example
.PHONY: clean
clean:
rm -f example
@mhanne
mhanne / gist:9338371
Created March 4, 2014 01:17
Blind liability proof based on bitcoin merkle trees
# Blind liability proof based on bitcoin merkle trees
module BLProof
def self.sha256 data
Digest::SHA256.base64digest(data)
end
def self.hash_nodes a, b
value = a[:value] + b[:value]
hash = sha256( value.to_s + a[:hash] + b[:hash] )