HiveBrain v1.2.0
Get Started
← Back to all entries
snippetjavascriptCritical

Generate a Hash from string in Javascript

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
fromgeneratehashstringjavascript

Problem

I need to convert strings to some form of hash. Is this possible in JavaScript?

I'm not utilizing a server-side language so I can't do it that way.

Solution

`const generateHash = (string) => {
let hash = 0;
for (const char of string) {
hash = (hash

Context

Stack Overflow Q#7616461, score: 1087

Revisions (0)

No revisions yet.