Skip to content

Instantly share code, notes, and snippets.

View marete's full-sized avatar

Brian Gitonga Marete marete

View GitHub Profile

Keybase proof

I hereby claim:

  • I am marete on github.
  • I am bgmarete (https://keybase.io/bgmarete) on keybase.
  • I have a public key ASD6diZKS2hV0r4abtB3mGgvewKd4j9XZrf5n1Mhf6LtkAo

To claim this, I am signing this object:

#!/bin/bash
trap "echo '*** Last command failed'; exit 1" ERR INT TERM QUIT
COUNT=0
for Z in 0 6; do
for COMPRESSION_ALGO in Uncompressed ZIP ZLIB BZIP2; do
for CIPHER in IDEA 3DES CAST5 BLOWFISH AES AES192 AES256 TWOFISH CAMELLIA128 CAMELLIA192 CAMELLIA256; do
for HASH in MD5 SHA1 RIPEMD160 SHA256 SHA384 SHA512 SHA224; do
@marete
marete / 1e5058a2efade00c9405b4544cfb3917045486de.output
Created April 30, 2015 20:07
gofuzz openpgp ReadMessage() crasher
SIGABRT: abort
PC=0x437102
goroutine 1 [running]:
runtime.memclr(0xc2080367d0, 0x50)
/tmp/go-fuzz-build851796584/src/runtime/memclr_amd64.s:97 +0x162 fp=0xc20805c738 sp=0xc20805c730
runtime.mallocgc(0x50, 0x5fa140, 0x760610b400000001, 0x472e0c)
/tmp/go-fuzz-build851796584/src/runtime/malloc.go:190 +0x92b fp=0xc20805c7e8 sp=0xc20805c738
runtime.newobject(0x5fa140, 0x8)
/tmp/go-fuzz-build851796584/src/runtime/malloc.go:353 +0x49 fp=0xc20805c810 sp=0xc20805c7e8
@marete
marete / fsync-bench.go
Created July 5, 2014 11:25
fsync benchmark
package main
import (
"flag"
"io"
"os"
)
const blockSize = 70 << 10
@marete
marete / keyring.go
Created August 15, 2013 12:38
Print out every imaginable detail about the keys in you OpenPGP keyring as a JSON array. Call it like this: `keyring ~/.gnupg/pubring.gpg
package main
import (
_ "code.google.com/p/go.crypto/md4"
"code.google.com/p/go.crypto/openpgp"
_ "code.google.com/p/go.crypto/ripemd160"
_ "crypto/md5"
_ "crypto/sha1"
_ "crypto/sha256"
_ "crypto/sha512"
@marete
marete / .gitignore
Last active December 20, 2015 20:19
Use Go's openpgp implementation to symmetrically encrypt a file, possibly with compression.
symmetric-encrypt
@marete
marete / decrypt-symmetric.go
Created June 29, 2013 22:48
I am currently reviewing Go's OpenPGP implementation with a view of possibly implementing bzip2 support for it, as well as testing compatibility with GNUPG. This is a simple GIST that shows how to decrypt a symmetrically encrypted file using go.crypto/openpgp. It can be useful for testing go.crypto/openpgp compatibility with various symmetric ci…
package main
import (
"code.google.com/p/go.crypto/openpgp"
"errors"
"io"
"log"
"os"
)
@marete
marete / ssh-pk-auth-http-tunnel.go
Created May 28, 2013 17:17
A simple Go program demonstrating two applications of code.google.com/p/go.crypto/ssh: Authentication using public key crypto and the tunneling of a HTTP request through the resulting SSH connection. In this gist, the remote SSH server is on localhost and the HTTP URL tunneled over the established secure connection is http://localhost:6060. But,…
package main
import (
"code.google.com/p/go.crypto/ssh"
"crypto"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
//"fmt"
"io"
@marete
marete / http.go
Created November 10, 2012 20:24
In Go/Golang, authenticate all HTTP connections in one place (No code duplication)
package main
import "net/http"
import "io"
import "runtime"
import "log"
type authHandler func(http.ResponseWriter, *http.Request)
func allowed(r *http.Request) bool {
@marete
marete / bench.go
Created October 7, 2012 20:38
Multithreaded RFC 868 (Time Server) Benchmark
package main
import "github.com/marete/rfc868"
import "time"
import "fmt"
import "runtime"
import "log"
const iterations = 1000000
const con = 10 // concurrency