Socket
Socket
Sign inDemoInstall

@denox/fnv1a

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @denox/fnv1a

FNV-1a non-cryptographic hash function.


Version published
Maintainers
1
Created

Readme

Source

fnv1a

FNV-1a is a fast non-cryptographic hash function with great distribution rare collisions.

Usage Deno

import fnv1a from "https://deno.land/x/fnv1a/mod.ts";

Usage Node

This is a port of @sindresorhus/fnv1a, through the code is slightly by using the newer TextEncoder standard.

import fnv1a from "@denox/fnv1a";

fnv1a("🦄🌈", { size: 32 });
//=> 2_868_248_295n

fnv1a("🦄🌈", { size: 128 });
//=> 13_487_074_350_300_261_116_944_693_128_525_960_095n

Number(fnv1a("🦄🌈", { size: 32 }));
//=> 2_868_248_295

API

fnv1a(string, options?)

Returns the hash as a positive BigInt.

If you need it as a number, use 32 as size and wrap the return value in Number(…).

options

Type: object

size

Type: number
Values: 32 | 64 | 128 | 256 | 512 | 1024
Default: 32

The bit size of the hash.

Keywords

FAQs

Last updated on 20 Oct 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc