Browse Source

Truncate IDs to a more reasonable length

Matt Baer 1 year ago
parent
commit
77a6bc9413
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      paste.go

+ 1
- 1
paste.go View File

@@ -45,7 +45,7 @@ func createPost(w http.ResponseWriter, r *http.Request) {
45 45
 	data := r.FormValue("stuff")
46 46
 	h := md5.New()
47 47
 	idHash := h.Sum([]byte(data))
48
-	id := base64.StdEncoding.EncodeToString(idHash)
48
+	id := base64.StdEncoding.EncodeToString(idHash)[:20]
49 49
 
50 50
 	err := ioutil.WriteFile(id+".txt", []byte(data), 0600)
51 51
 	if err != nil {