aboutsummaryrefslogtreecommitdiff
path: root/utils/transformers/tokens.go
diff options
context:
space:
mode:
Diffstat (limited to 'utils/transformers/tokens.go')
-rw-r--r--utils/transformers/tokens.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/utils/transformers/tokens.go b/utils/transformers/tokens.go
index 7ad36ed..f2f2e0b 100644
--- a/utils/transformers/tokens.go
+++ b/utils/transformers/tokens.go
@@ -1,6 +1,7 @@
package transformers
import (
+ "crypto"
"crypto/rand"
"encoding/hex"
)
@@ -12,3 +13,9 @@ func GenerateRandomToken() (string, error) {
}
return hex.EncodeToString(bytes), nil
}
+
+func GenerateTokenFromString(input string) string {
+ hasher := crypto.SHA256.New()
+ hasher.Write([]byte(input))
+ return hex.EncodeToString(hasher.Sum(nil))
+}