DJB2a (ES)
DistBoard @hugoalh ● GitHub ● JSR ● NPM
An ECMAScript module to get the non-cryptographic hash of the data with algorithm DJB2a (32 bits).
Runtime Targets
Any runtime which support ECMAScript should able to use this; These runtimes are officially supported:
Runtime Permissions
This does not request any runtime permission.
Sources & Entrypoints
- GitHub Raw
https://raw.githubusercontent.com/hugoalh/djb2a-es/{Tag}/mod.ts - JSR
jsr:@hugoalh/djb2a[@{Tag}] - NPM
npm:@hugoalh/djb2a[@{Tag}]
| Name | Path | Description |
|---|---|---|
. |
./mod.ts |
Default. |
- Different runtimes have vary support for the sources and entrypoints, visit the runtime documentation for more information.
- It is recommended to include tag for immutability.
- These are not part of the public APIs hence should not be used:
- Benchmark/Test file (e.g.:
example.bench.ts,example.test.ts).- Entrypoint name or path include any underscore prefix (e.g.:
_example.ts,foo/_example.ts).- Identifier/Namespace/Symbol include any underscore prefix (e.g.:
_example,Foo._example).
APIs
class DJB2a { constructor(data?: DJB2aAcceptDataType); get freezed(): boolean; freeze(): this; hash(): Uint8Array; hashHex(): string; update(data: DJB2aAcceptDataType): this; updateFromStream(stream: ReadableStream<DJB2aAcceptDataType>): Promise<this>; }type DJB2aAcceptDataType = | string | BigUint64Array | Uint8Array | Uint16Array | Uint32Array;
- For the full or prettier documentation, can visit via:
Examples
new DJB2a("hello").hashHex(); //=> "0A9CEDE7"