Skip to content

Instantly share code, notes, and snippets.

@bryanl
Created June 12, 2014 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanl/b9afa621fb3968914dcd to your computer and use it in GitHub Desktop.
Save bryanl/b9afa621fb3968914dcd to your computer and use it in GitHub Desktop.
package main
import (
"crypto/md5"
"fmt"
"io/ioutil"
"code.google.com/p/go.crypto/ssh"
)
func main() {
b, err := ioutil.ReadFile("/tmp/id_rsa2.pub")
if err != nil {
panic(err)
}
fmt.Println(string(b))
pubkey, err := ssh.ParsePublicKey(b)
if err != nil {
panic(err)
}
fmt.Printf("%x", md5.Sum(pubkey.Marshal()))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment