Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/sync/node_modules/farmhash-modern/lib/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import * as farmhash from '../bin/bundler/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));
}
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0367 ]-- |