aboutsummaryrefslogtreecommitdiff
path: root/hashing
diff options
context:
space:
mode:
authorjackyzha0 <[email protected]>2020-05-09 20:15:59 -0700
committerjackyzha0 <[email protected]>2020-05-09 20:15:59 -0700
commitdedabf41a18820527aed9e77b75564e69c9030ce (patch)
tree9258832576f9c1bcad6126cf76ef8f7f6a128e82 /hashing
parentMerge pull request #3 from jackyzha0/doc-expiry (diff)
downloadctrl-v-dedabf41a18820527aed9e77b75564e69c9030ce.tar.xz
ctrl-v-dedabf41a18820527aed9e77b75564e69c9030ce.zip
folder refactor
Diffstat (limited to 'hashing')
-rw-r--r--hashing/hash.go26
1 files changed, 0 insertions, 26 deletions
diff --git a/hashing/hash.go b/hashing/hash.go
deleted file mode 100644
index 400659e..0000000
--- a/hashing/hash.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package hashing
-
-import (
- "crypto/md5"
- "encoding/hex"
- "math/big"
- "time"
-)
-
-const UrlLength = 7
-
-// GenerateURI creates a unique identifier for a paste based on ip and timestamp
-func GenerateURI(ip string) string {
- timeStamp := time.Now().String()
- return hashString(ip + timeStamp)[:UrlLength]
-}
-
-// hashes using MD5 and then converts to base 62
-func hashString(text string) string {
- hash := md5.Sum([]byte(text))
- hexStr := hex.EncodeToString(hash[:])
-
- bi := big.NewInt(0)
- bi.SetString(hexStr, 16)
- return bi.Text(62)
-} \ No newline at end of file