Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
faviconer.go
package main
import (
"encoding/base64"
"fmt"
"io/ioutil"
"net/http"
"github.com/twmb/murmur3"
)
func main() {
final := ""
fix := 76
s := make([]string, 0)
// pull file from the internet
f, _ := http.Get("https://medium.com/favicon.ico")
content, _ := ioutil.ReadAll(f.Body)
str := base64.StdEncoding.EncodeToString(content)
// slice up string
for i := 0; i*fix+fix < len(str); i++ {
it := str[i*fix : i*fix+fix]
s = append(s, it)
}
// find last piece of string
findlen := len(s) * fix
last := str[findlen:] + "\n"
// put it all together
for _, s := range s {
final = final + s + "\n"
}
str = final + last
// do murmurhash3 stuff
mm3 := murmur3.StringSum32(str)
// convert uint32 to int32
fmt.Println(int32(mm3))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.