Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xxhashjs

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xxhashjs - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

.lmd/xxhash.lmd.json

6

History.md

@@ -0,1 +1,7 @@

0.0.2 / 2014-01-19
==================
* added tests
* updated README
0.0.1 / 2014-01-01

@@ -2,0 +8,0 @@ ==================

6

package.json
{
"name": "xxhashjs",
"version": "0.0.1",
"version": "0.0.2",
"description": "xxHash in Javascript",

@@ -8,2 +8,3 @@ "main": "xxhash.js",

"test": "mocha"
, "prepublish": "lmd build xxhash; lmd build xxhash.min"
},

@@ -26,2 +27,5 @@ "repository": {

}
, "devDependencies": {
"lmd": "1.11.x"
}
}

13

README.md

@@ -17,9 +17,6 @@ # Javascript implementation of xxHash

```javascript
<script src="/your/path/to/uint32.js"></script>
<script src="/your/path/to/xxhash.js"></script>
<script src="/your/path/to/xxhash.lmd.js"></script>
```
NB. xxhashjs depends on the [uint32 library](https://github.com/pierrec/js-cuint) that emulates unsigned 32 bits integers in Javascript.
## Examples

@@ -40,3 +37,7 @@

* More examples in the examples directory:
* Compute xxHash from a file data
* Use xxHashjs in the browser
## Usage

@@ -70,4 +71,4 @@

Add data for hashing. The data can either be a string or a NodeJS Buffer object.
* `XXH.digest()`
Finalize the hash calculations
* `XXH.digest()` (_UINT32_)
Finalize the hash calculations and returns an UINT32 object. The hash value can be retrived with toString(<radix>).

@@ -74,0 +75,0 @@

@@ -9,5 +9,3 @@ /**

var UINT32 = typeof root['UINT32'] == 'function'
? root['UINT32']
: require('cuint').UINT32
var UINT32 = require('cuint').UINT32

@@ -152,2 +150,14 @@ /*

)
this.v2.xxh_update(
(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)
, (input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)
)
this.v3.xxh_update(
(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)
, (input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)
)
this.v4.xxh_update(
(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)
, (input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)
)
} else {

@@ -158,35 +168,11 @@ this.v1.xxh_update(

)
}
if (isString) {
this.v2.xxh_update(
(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)
, (input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)
)
} else {
this.v2.xxh_update(
(input[p+1] << 8) | input[p]
, (input[p+3] << 8) | input[p+2]
)
}
if (isString) {
this.v3.xxh_update(
(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)
, (input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)
)
} else {
this.v3.xxh_update(
(input[p+1] << 8) | input[p]
, (input[p+3] << 8) | input[p+2]
)
}
if (isString) {
this.v4.xxh_update(
(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)
, (input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)
)
} else {
this.v4.xxh_update(
(input[p+1] << 8) | input[p]

@@ -212,2 +198,17 @@ , (input[p+3] << 8) | input[p+2]

)
p += 4
this.v2.xxh_update(
(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)
, (input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)
)
p += 4
this.v3.xxh_update(
(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)
, (input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)
)
p += 4
this.v4.xxh_update(
(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)
, (input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)
)
} else {

@@ -218,38 +219,14 @@ this.v1.xxh_update(

)
}
p += 4
if (isString) {
p += 4
this.v2.xxh_update(
(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)
, (input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)
)
} else {
this.v2.xxh_update(
(input[p+1] << 8) | input[p]
, (input[p+3] << 8) | input[p+2]
)
}
p += 4
if (isString) {
p += 4
this.v3.xxh_update(
(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)
, (input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)
)
} else {
this.v3.xxh_update(
(input[p+1] << 8) | input[p]
, (input[p+3] << 8) | input[p+2]
)
}
p += 4
if (isString) {
p += 4
this.v4.xxh_update(
(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)
, (input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)
)
} else {
this.v4.xxh_update(
(input[p+1] << 8) | input[p]

@@ -256,0 +233,0 @@ , (input[p+3] << 8) | input[p+2]

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc