MCPcopy Create free account
hub / github.com/Marus/cortex-debug / djb2

Function djb2

src/grapher/programstatsgraph.ts:19–25  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

17}
18
19function djb2(str: string): number {
20 let hash = 5381;
21 for (let i = 0; i < str.length; i++) {
22 hash = ((hash << 5) + hash) + str.charCodeAt(i); /* hash * 33 + c */
23 }
24 return hash;
25}
26
27// tslint:disable-next-line:max-line-length
28const COLORS: string[] = ['#C0392B', '#9B59B6', '#2980B9', '#1ABC9C', '#16A085', '#F1C40F', '#E67E22', '#D35400', '#E74C3C', '#8E44AD', '#3498DB', '#2ECC71', '#F39C12'];

Callers 1

hashStringToColorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected