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

hashids

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hashids - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

.npmignore

4

lib/hashids.js
// Generated by CoffeeScript 1.3.1
var hashids;
hashids = (function() {
module.exports = hashids = (function() {

@@ -159,3 +159,1 @@ hashids.name = 'hashids';

})();
module.exports = hashids;
{
"author": "Ivan Akimov <ivan@grather.com> (http://hashids.org)",
"name": "hashids",
"description": "A tiny JavaScript class to generate YouTube-like hashes from one or many ids.",
"version": "0.1.0",
"description": "A tiny Node.js module to generate YouTube-like hashes from one or many ids.",
"version": "0.1.1",
"preferGlobal": true,

@@ -13,6 +13,9 @@ "homepage": "http://hashids.org",

"main": "index.js",
"dependencies": {},
"dependencies": {
"crypto": ""
},
"devDependencies": {},
"optionalDependencies": {},
"license": "MIT",
"keywords": ["hashids", "hash", "ids", "youtube"],
"engines": {

@@ -19,0 +22,0 @@ "node": "*"

@@ -23,4 +23,6 @@

Hashes look similar to what YouTube, Bitly, and other popular websites have: `p9`, `pZsCB`, `qKuBQuxc`. They are case-sensitive, include alphanumeric characters and a dash.
Hashes look similar to what YouTube, Bitly, and other popular websites have: `p9`, `pZsCB`, `qKuBQuxc`. They are case-sensitive, include alphanumeric characters and a dash by default.
(You can customize the alphabet from which your hashes are created.)
## What's different?

@@ -30,2 +32,4 @@

This is really useful for complex or clustered systems where you need to remember more than one id.
There is no limit to how many ids you can encode into one hash. The more ids you provide and the bigger the numbers, the longer your hash will be.

@@ -35,4 +39,4 @@

1. Get [Node.js](http://nodejs.org/) if you haven't already: [http://nodejs.org/#download](http://nodejs.org/#download)
2. Install [npm](http://npmjs.org/) (package manager for Node).
1. Grab [Node.js](http://nodejs.org/) and install if you haven't already: [http://nodejs.org/#download](http://nodejs.org/#download)
2. Same with [npm](http://npmjs.org/) (package manager for Node).
3. Install [hashids](http://hashids.org/):

@@ -51,6 +55,6 @@

```javascript
var hashids = require('hashids');
var hashids = new hashids('this is my salt');
var hash = hashids.encode(12345);
var hashids = require('hashids');
hashids = new hashids('this is my salt');
var hash = hashids.encode(12345);
```

@@ -65,6 +69,6 @@

```javascript
var hashids = require('hashids');
var hashids = new hashids('this is my salt');
var hash = hashids.encode(683, 94108, 123, 5);
var hashids = require('hashids');
hashids = new hashids('this is my salt');
var hash = hashids.encode(683, 94108, 123, 5);
```

@@ -81,10 +85,10 @@

```javascript
var hashids = require('hashids');
var hashids = new hashids('this is my salt');
var hash1 = hashids.decode('7OR');
console.log(hash1);
var hash2 = hashids.decode('nEFOM6s7wI6');
console.log(hash2);
var hashids = require('hashids');
hashids = new hashids('this is my salt');
var hash1 = hashids.decode('7OR');
console.log(hash1);
var hash2 = hashids.decode('nEfOM6s2oIz');
console.log(hash2);
```

@@ -95,4 +99,4 @@

```javascript
[ 12345 ]
[ 683, 94108, 762, 4 ]
[ 12345 ]
[ 683, 94108, 123, 5 ]
```

@@ -102,13 +106,13 @@

The primary purpose of this hash function is to make ids look different. It's not meant or tested to be used primarily as a security algorithm.
The primary purpose of hashids is to make ids look different. It's not meant or tested to be used as a security algorithm.
Having said that, this class does try to make these hashes un-guessable and unique.
Let's for example look at the following code:
Let's look at the following example:
```javascript
var hashids = require('hashids');
var hashids = new hashids('this is my salt');
var hash = hashids.encode(5, 5, 5, 5);
var hashids = require('hashids');
hashids = new hashids('this is my salt');
var hash = hashids.encode(5, 5, 5, 5);
```

@@ -125,6 +129,6 @@

```javascript
var hashids = require('hashids');
var hashids = new hashids('this is my salt');
var hash = hashids.encode(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
var hashids = require('hashids');
hashids = new hashids('this is my salt');
var hash = hashids.encode(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
```

@@ -138,2 +142,2 @@

Since these hashes are most likely to be used in user-visible places, like the url -- no matter the salt value, they will not make up basic curse words by design, like the f-bomb or "#2".
Since these hashes are most likely to be used in user-visible places, like the url -- no matter the salt value, they should not make up basic curse words by design, like the f-bomb or "#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