Skip to content

Commit

Permalink
Updated README and added path.join fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nhahn committed Dec 24, 2015
1 parent 49980d8 commit 85bb3d7
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 9 deletions.
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Organic Hash
============

Converts strings to awesome scifi objects!!

Organic Hash hashes strings (user ID, hashes) to a human-readable, scifi-themed
representation.

## Demo

http://truly-civilized-pancakes.herokuapp.com

## Install

```bash
$ npm install organic_hash --save
```

## Usage

Basic usage

```javascript
var organicHash = require('organic_hash')();
organicHash.hash('ID_A3AHG7FKPIV07')
// "clearly-mongoloid-pressure"

organicHash.hash('asldkjasldkjasdlkajsd')
// 'technically-common-device'

organicHash.hash('nhahn')
// 'dangerously-successful-gun'
```

Different length

```javascript
var organicHash = require('organic_hash')(4);
organicHash.hash('Zero')
// 'slowly-regular-personally-hibernation'
```

Random hashes

```javascript
var organicHash = require('organic_hash')();
organicHash.rand();
// 'purposefully-weak-neurotoxin'
```

## Authors

Nathan Hahn <[email protected]> ported the library to Javascript
Joseph Chee Chang <[email protected]> and Zero Cho <[email protected]>

## License

Apache License, Version 2.0

## URL

https://github.com/nhahn/organic_hash


7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
var SHA256 = require("crypto-js/sha256");
var fs = require("fs");
var path = require("path");

var NOUN = fs.readFileSync('data/noun.dat').toString().split('\n');
var ADJ = fs.readFileSync('data/adj.dat').toString().split('\n');
var ADV = fs.readFileSync('data/adv.dat').toString().split('\n');
var NOUN = fs.readFileSync(path.join(__dirname, 'data', 'noun.dat')).toString().split('\n');
var ADJ = fs.readFileSync(path.join(__dirname, 'data', 'adj.dat')).toString().split('\n');
var ADV = fs.readFileSync(path.join(__dirname, 'data', 'adv.dat')).toString().split('\n');

// Adds two arrays for the given base (10 or 16), returning the result.
// This turns out to be the only "primitive" operation we need.
Expand Down
18 changes: 12 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
{
"name": "orgnic_hash",
"version": "1.0.0",
"description": "A javascript version of josephcc organic hash",
"name": "organic_hash",
"title": "organic_hash",
"version": "1.0.1",
"description": "Converts strings to awesome scifi objects!! A port of the Josephcc ruby gem of the same name",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/nhahn/organic_hash"
},
"homepage": "https://github.com/nhahn/organic_hash",
"keywords": [
"hash",
"nlp"
"crypto"
],
"author": "Nathan Hahn",
"license": "MIT",
"license": "Apache-2.0",
"dependencies": {
"crypto-js": "^3.1.5",
"crypto-js": "^3.1.5"
}
}

0 comments on commit 85bb3d7

Please sign in to comment.