Update sdbm-hash.md
This commit is contained in:
@ -4,10 +4,10 @@ It uses the charCodeAt-methode and the shift-operator.
|
|||||||
|
|
||||||
``` js
|
``` js
|
||||||
function sdbm(s) {
|
function sdbm(s) {
|
||||||
var hashCode = new Number();
|
var hashCode = 0;
|
||||||
for (var i = 0; i < s.length; i++) {
|
for (var i = 0; i < s.length; i++) {
|
||||||
hashCode = s.charCodeAt(i) + (hashCode << 6) + (hashCode << 16) - hashCode;
|
hashCode = s.charCodeAt(i) + (hashCode << 6) + (hashCode << 16) - hashCode;
|
||||||
}
|
}
|
||||||
return hashCode;
|
return hashCode;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user