Replace hash with sha1
This commit is contained in:
parent
f1ba785e38
commit
20e636620d
|
@ -95,8 +95,8 @@ func GenerateName() string {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hash hashes paste into a sha1 hash
|
// Sha1 hashes paste into a sha1 hash
|
||||||
func Hash(paste string) string {
|
func Sha1(paste string) string {
|
||||||
hasher := sha1.New()
|
hasher := sha1.New()
|
||||||
|
|
||||||
hasher.Write([]byte(paste))
|
hasher.Write([]byte(paste))
|
||||||
|
@ -139,7 +139,7 @@ func Save(raw string, lang string, title string, expiry string) Response {
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
// hash paste data and query database to see if paste exists
|
// hash paste data and query database to see if paste exists
|
||||||
sha := Hash(raw)
|
sha := Sha1(raw)
|
||||||
query, err := db.Query("select id, title, hash, data, delkey from pastebin where hash=?", sha)
|
query, err := db.Query("select id, title, hash, data, delkey from pastebin where hash=?", sha)
|
||||||
|
|
||||||
if err != sql.ErrNoRows {
|
if err != sql.ErrNoRows {
|
||||||
|
|
Loading…
Reference in New Issue