HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-10-0-8-47 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:31:58 UTC 2024 aarch64
User: ubuntu (1000)
PHP: 8.1.2-1ubuntu2.22
Disabled: NONE
Upload Files
File: /var/www/javago-api-updates/node_modules/farmhash-modern/lib/index.mjs
import * as farmhash from '../bin/nodejs/farmhash_modern.js';
function asBuffer(input) {
    if (typeof input === 'string') {
        return new TextEncoder().encode(input);
    }
    if (input instanceof Uint8Array) {
        return input;
    }
    throw new Error('Expected input to be a string or Uint8Array');
}
function asUnsigned32BitNumber(input) {
    if (input === input >>> 0) {
        return input;
    }
    throw new Error(`Expected input to be a 32-bit unsigned integer, got ${input}`);
}
function asUnsigned64BitNumber(input) {
    if (typeof input === 'bigint' &&
        input >= 0 &&
        input <= 18446744073709551615n) {
        return input;
    }
    throw new Error(`Expected input to be a 64-bit unsigned integer, got ${input}`);
}
/**
 * Create a new farmhash based u32 for a string or an array of bytes.
 * Fingerprint value should be portable and stable across library versions
 * and platforms.
 */
export function fingerprint32(input) {
    return farmhash.fingerprint32(asBuffer(input));
}
/**
 * Create a new farmhash based u64 for a string or an array of bytes.
 * Fingerprint value should be portable and stable across library versions
 * and platforms.
 */
export function fingerprint64(input) {
    return farmhash.fingerprint64(asBuffer(input));
}
/**
 * Create a new farmhash based i64 for a string or an array of bytes.
 * Fingerprint value should be portable and stable across library versions
 * and platforms.
 *
 * This matches the format used by BigQuery's FARM_FINGERPRINT function.
 */
export function bigqueryFingerprint(input) {
    return farmhash.bigquery_fingerprint(asBuffer(input));
}
/**
 * Create a new farmhash based u32 for an array of bytes. Hash value may
 * vary with library version.
 */
export function hash32(input) {
    return farmhash.hash32(asBuffer(input));
}
/**
 * Create a new farmhash based u32 for an array of bytes with a given seed.
 * Hash value may vary with library version.
 */
export function hash32WithSeed(input, seed) {
    return farmhash.hash32_with_seed(asBuffer(input), asUnsigned32BitNumber(seed));
}
/**
 * Create a new farmhash based u64 for an array of bytes. Hash value may
 * vary with library version.
 */
export function hash64(input) {
    return farmhash.hash64(asBuffer(input));
}
/**
 * Create a new farmhash based u64 for an array of bytes with a given seed.
 * Hash value may vary with library version.
 */
export function hash64WithSeed(input, seed) {
    return farmhash.hash64_with_seed(asBuffer(input), asUnsigned64BitNumber(seed));
}