MCPcopy Create free account
hub / github.com/effect-app/libs / number

Function number

repos/effect/packages/effect/src/Hash.ts:336–354  ·  view source on GitHub ↗
(n: number)

Source from the content-addressed store, hash-verified

334 while (n > 0xffffffff) {
335 h ^= n /= 0xffffffff
336 }
337 return optimize(h)
338}
339
340/**
341 * Computes a hash value for a string using the djb2 algorithm.
342 *
343 * **When to use**
344 *
345 * Use when you need a string field to contribute to a custom structural hash
346 * implementation.
347 *
348 * **Details**
349 *
350 * This function implements a variation of the djb2 hash algorithm, which is
351 * known for its good distribution properties and speed. It processes each
352 * character of the string to produce a consistent hash value.
353 *
354 * **Example** (Hashing strings)
355 *
356 * ```ts import.meta.vitest
357 * import { Hash } from "effect"

Callers 3

hashFunction · 0.70
randomFunction · 0.70
dateTime.tsFile · 0.50

Calls 2

optimizeFunction · 0.85
stringFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…