@devries-cameron20 / composio Mirror · read-only
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 04:45 UTC

next
ts 11 lines 379 Bytes
Raw
1 /**
2 * djb2 string hash (seed 5381, xor variant), normalized to a non-negative
3 * 32-bit integer. Callers pick their own string encoding (hex, base36, ...).
4 */
5 export const djb2Hash = (value: string): number => {
6 let hash = 5381;
7 for (let index = 0; index < value.length; index += 1) {
8 hash = (hash * 33) ^ value.charCodeAt(index);
9 }
10 return Math.abs(hash >>> 0);
11 };