From 6b3d460dc1b969707532b36b965209821c827113 Mon Sep 17 00:00:00 2001 From: Hector Jusforgues Date: Sun, 14 Jun 2015 19:13:46 +0700 Subject: [PATCH] Use fnv64a instead of sha256 for cache keys --- cache.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cache.go b/cache.go index c5fecae..da5b98a 100644 --- a/cache.go +++ b/cache.go @@ -3,7 +3,6 @@ package httpcache import ( "bufio" "bytes" - "crypto/sha256" "errors" "fmt" "io" @@ -16,6 +15,7 @@ import ( "strings" "time" + "hash/fnv" "github.com/rainycape/vfs" ) @@ -190,8 +190,8 @@ func (c *Cache) Freshen(res *Resource, keys ...string) error { } func hashKey(key string) string { - h := sha256.New() - io.WriteString(h, key) + h := fnv.New64a() + h.Write([]byte(key)) return fmt.Sprintf("%x", h.Sum(nil)) }