string-hash

WebJar for string-hash

License

License

GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

string-hash
Last Version

Last Version

1.1.3
Release Date

Release Date

Type

Type

jar
Description

Description

string-hash
WebJar for string-hash
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/darkskyapp/string-hash

Download string-hash

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/string-hash/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>string-hash</artifactId>
    <version>1.1.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/string-hash/
implementation 'org.webjars.npm:string-hash:1.1.3'
// https://jarcasting.com/artifacts/org.webjars.npm/string-hash/
implementation ("org.webjars.npm:string-hash:1.1.3")
'org.webjars.npm:string-hash:jar:1.1.3'
<dependency org="org.webjars.npm" name="string-hash" rev="1.1.3">
  <artifact name="string-hash" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='string-hash', version='1.1.3')
)
libraryDependencies += "org.webjars.npm" % "string-hash" % "1.1.3"
[org.webjars.npm/string-hash "1.1.3"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

string-hash

A fast string hashing function for Node.JS. The particular algorithm is quite similar to djb2, by Dan Bernstein and available here. Differences include iterating over the string backwards (as that is faster in JavaScript) and using the XOR operator instead of the addition operator (as described at that page and because it obviates the need for modular arithmetic in JavaScript).

The hashing function returns a number between 0 and 4294967295 (inclusive).

Thanks to cscott for reminding us how integers work in JavaScript.

Example

npm install string-hash or yarn add string-hash, then:

const stringHash = require("string-hash");
console.log(stringHash("foo")); // prints "193420387"

Note that the return value is always an unsigned, 32-bit integer.

License

To the extend possible by law, The Dark Sky Company, LLC has waived all copyright and related or neighboring rights to this library.

org.webjars.npm

The Dark Sky Company, LLC

Versions

Version
1.1.3