Skip to content

Instantly share code, notes, and snippets.

View oleganza's full-sized avatar

Oleg Andreev oleganza

View GitHub Profile
require 'strscan'
require 'cgi'
module HTMLEscaper
ENTITIES = {
"<" => "&lt;",
">" => "&gt;",
'"' => "&quot;",
'&' => "&amp;"
}
@oleganza
oleganza / NSObject+OASelectorNotifications.h
Created August 25, 2011 11:43
NSObject+OASelectorNotifications.h
/*
Oleg Andreev <oleganza@gmail.com>
January 25, 2011
With NSNotificationCenter you post notifications with a name like MyNotification.
Observer subscribes to this name with some selector like myNotification:
To make things easier and less verbose, we won't declare notification names, but only the selectors.
#import "NSData+OADataHelpers.h"
@implementation NSData (OADataHelpers)
- (NSString*) UTF8String
{
return [[[NSString alloc] initWithData:[self dataByHealingUTF8Stream] encoding:NSUTF8StringEncoding] autorelease];
}
// Replaces all broken sequences by � character and returns NSData with valid UTF-8 bytes.
-----------
Please try this:
1. Quit Gitbox.
2. Delete ~/Library/Preferences/com.oleganza.gitbox.plist
3. Run in Terminal: defaults delete com.oleganza.gitbox
4. Run in Terminal: git config --global push.default matching
5. Open Gitbox.
@oleganza
oleganza / NSData+OADataHelpers.m
Last active December 9, 2022 03:50
Creating NSString from NSData by fixing invalid UTF8 characters
// Author: Oleg Andreev <oleganza@gmail.com>
// May 28, 2011
// Do What The Fuck You Want Public License <http://www.wtfpl.net>
#import "NSData+OADataHelpers.h"
#if !__has_feature(objc_arc)
#error ARC must be enabled!
#endif
@karlgluck
karlgluck / Hash Ladders for Shorter Lamport Signatures.md
Last active March 31, 2024 17:53
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?

@kac-
kac- / blind_oleg.go
Last active April 10, 2024 09:59
Blind signatures for Bitcoin transactions
package main
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/sha256"
"fmt"
"math/big"
)