ohif-viewer/legacy/Packages/active-entry/lib/hashCodeGenerator.js
2018-12-12 09:10:39 +01:00

10 lines
315 B
JavaScript

String.prototype.hashCode = function() {
var hash = 0, i, chr, len;
if (this.length === 0) return hash;
for (i = 0, len = this.length; i < len; i++) {
chr = this.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer
}
return hash;
};