Code & Deploy
siGit Code
Git Hosting
Toggle menu
siGit Code
Git Hosting
Sign in
Sign in
@davoodmehraban89
/
medusa
Fork
0
medusa
/
packages
/
core
/
utils
/
src
/
common
/
simple-hash.ts
Code
Commits
Issues
Pulls
Cloud Agent
CICD
main
automation/medusa-upstream-review
main
project/medusa-foundation-audit
security/codeql-dependabot-gitleaks
ts
8 lines
217 Bytes
Copy permalink
Copy
Raw
1
// DJB2 hash function
2
export
function
simpleHash
(
text
:
string
):
string
{
3
let
hash
=
5381
4
for
(
let
i
=
0
;
i
<
text
.
length
;
i
++
)
{
5
hash
=
(
hash
<<
5
)
+
hash
+
text
.
charCodeAt
(
i
)
6
}
7
return
hash
.
toString
(
16
)
8
}