Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/pup/lib/core/loadbalancer.ts>hashCode

Universal process manager built in Deno
Go to Latest
function hashCode
import { hashCode } from "https://deno.land/x/pup@1.0.0-beta.36/lib/core/loadbalancer.ts";

Generates a hash code for a given IP address string, based on a simple hashing algorithm that distributes the values evenly across an array.

Examples

// Returns 31679 const hash1 = ipHash("192.168.1.1");

// Returns 48437 const hash2 = ipHash("10.0.0.1");

Parameters

s: string
  • The IP address/hostname to generate a hash code for.

Returns

number

The hash code for the IP address.