Skip to content
/ xxh32 Public

Fastest 0.5kb(gzip) JavaScript implementation of the XXH32(xxHash32) algorithm.

License

Notifications You must be signed in to change notification settings

cgiosy/xxh32

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xxh32

Fastest 0.5kb(gzip) JavaScript implementation of Cyan4973's XXH32 (xxHash32) algorithm.

Installation

npm i xxh32

and import it:

import xxh32 from "xxh32";

Without installation

You can directly import URL in ES Modules. (works in Browser, Deno)

import xxh32 from "https://unpkg.com/xxh32@1.4.0/dist/index.bundle.js";

or use dynamic import.

const { default: xxh32 } = await import("https://unpkg.com/xxh32@1.4.0/dist/index.bundle.js");

Usage

xxh32(new Uint8Array(222)) // === 2025467952

xxh32(new TextEncoder().encode("test")) // === 1042293711

const seed = 1234;
xxh32(new Uint8Array(222), seed) // === 2335345817

Streaming

import xxh32s from "xxh32/dist/stream.js";

or

import xxh32s from "https://unpkg.com/xxh32@1.4.0/dist/stream.bundle.js";

Usage (Streaming)

xxh32s().update(new Uint8Array(222)).digest() // === 2025467952

xxh32s()
  .update(new TextEncoder().encode("te"))
  .update(new TextEncoder().encode("st"))
  .digest() // === 1042293711

const seed = 1234;
xxh32s(seed)
  .update(new Uint8Array(111))
  .update(new Uint8Array(111))
  .digest() // === 2335345817

About

Fastest 0.5kb(gzip) JavaScript implementation of the XXH32(xxHash32) algorithm.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages