Skip to content

Instantly share code, notes, and snippets.

View dchest's full-sized avatar
☮️

Dmitry Chestnykh dchest

☮️
View GitHub Profile
@dchest
dchest / style.css
Created September 9, 2011 23:43
Stylebot CSS for new Google Groups
div.GOFTCUUBI3 {
min-height: 0;
}
div.GOFTCUUBJ3.GOFTCUUBGW {
padding: 5px;
height: 30px;
}
div.GOFTCUUBEE.GOFTCUUBCE.GOFTCUUBE4 {
@dchest
dchest / meet.c
Created July 3, 2011 18:10
Example of meet-in-the-middle attack (in C)
/* Written by Dmitry Chestnykh. Public domain. */
#include <err.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <openssl/blowfish.h>
#include <openssl/lhash.h>
/* Encryption and decryption */
@dchest
dchest / meet.go
Created July 3, 2011 09:06
Example of meet-in-the-middle attack
// Written by Dmitry Chestnykh. Public domain.
package main
import (
"crypto/blowfish"
"fmt"
"time"
)
func encrypt(key uint8, src string) string {
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"crypto/aes"
"crypto/cipher"
"compress/gzip"
@dchest
dchest / main.go
Created April 26, 2011 08:59
Program that fetches URL, inlines images, css and js and saves the result in HTML file. It's not finished, some inlining doesn't work.
package main
import (
"fmt"
"http"
"flag"
"os"
"bytes"
"io"
"encoding/base64"
@dchest
dchest / new
Created April 25, 2011 10:27
Part of my .gitconfig
[instaweb]
local = true
httpd = webrick
port = 4321
[gui]
fontdiff = -family Menlo -size 11 -weight normal -slant roman -underline 0 -overstrike 0
[alias]
st = status
@dchest
dchest / gist:923033
Created April 16, 2011 10:29
Password reset scheme
//
// Example.
//
// Your application must have a strong secret key for password reset purposes.
This key will be used to generate and verify password reset tokens. (If you
already have a secret key, for example, for authcookie package, it's better
not to reuse it, just use a different one.)
secret := []byte("assume we have a long randomly generated secret key here")
@dchest
dchest / docgo
Created April 13, 2011 02:31
docgo - Runs godoc with the current path and opens browser (on a Mac).
#!/bin/sh
#
# Runs godoc with the current path and opens browser (on a Mac).
#
godoc -http=":8888" -path="." 2> /dev/null &
pid=$!
trap 'kill $pid' INT
open "http://localhost:8888"
@dchest
dchest / goswitch
Created April 8, 2011 18:00
Switch between two different installations of Go
#!/bin/sh
#
# Switch between two different installations of Go:
#
# source goswitch dev
# ^ makes GOROOT ~/Sources/go
#
# source goswitch prod
# ^ makes GOROOT ~/go
@dchest
dchest / ecdsa.go
Created February 10, 2011 19:15
ECDSA implementation using Go's provided curves
package ecdsa
import (
"io"
"os"
"big"
"crypto/elliptic"
"sync"
)