github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

brainfucker / hashlib

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 37
    • 4
  • Source
  • Commits
  • Network (4)
  • Issues (1)
  • Downloads (1)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Switch Branches (1)
    • master ✓
  • Switch Tags (0)
  • Branch List
Sending Request…

lib for node which makes hashes — Read more

  Cancel

nodejs.ru

  Cancel
  • HTTP
  • Git Read-Only

This URL has Read+Write access

remove build dir 
brainfucker (author)
Mon Feb 22 02:04:27 -0800 2010
commit  a1a03f7dc857fa9c4f44
tree    2c33c838e3511cad20b0
parent  e48aafa913bcedd17807
hashlib /
name age
history
message
file .lock-wscript Thu Feb 18 06:34:25 -0800 2010 hmac_md5 added [brainfucker]
file README.md Thu Feb 18 08:20:56 -0800 2010 hmac_md5 help [brainfucker]
file file.js Fri Jan 22 04:34:52 -0800 2010 improve error reporting and fix readonly files ... [brainfucker]
file hashlib.cc Thu Feb 18 06:34:25 -0800 2010 hmac_md5 added [brainfucker]
file hmac_test.js Thu Feb 18 06:34:25 -0800 2010 hmac_md5 added [brainfucker]
directory lib/ Mon Feb 15 15:52:47 -0800 2010 working hmac_sha1 [brainfucker]
directory libhash/ Fri Jan 15 05:08:25 -0800 2010 move to freeBSD md5 lib, add md4, sha [brainfucker]
file makefile Mon Feb 15 15:52:47 -0800 2010 working hmac_sha1 [brainfucker]
file md5.js Wed Jan 20 09:17:13 -0800 2010 add async callback to md5_file function [brainfucker]
file test.file Wed Jan 20 09:17:13 -0800 2010 add async callback to md5_file function [brainfucker]
file test.js Thu Feb 18 06:34:25 -0800 2010 hmac_md5 added [brainfucker]
file test.php Fri Feb 12 06:08:19 -0800 2010 OSX compile fix [brainfucker]
file test.py Thu Jan 14 06:25:45 -0800 2010 Adding sha1, sha256, sha512 and md6 hashes [brainfucker]
directory test/ Thu Jan 14 06:25:45 -0800 2010 Adding sha1, sha256, sha512 and md6 hashes [brainfucker]
file wscript Fri Feb 12 06:08:19 -0800 2010 OSX compile fix [brainfucker]
README.md

Hashlib

Is a FAST nodejs(http://github.com/ry/node/) library for making hashes written in C/C++

Supports: md4, md5, md6, sha, sha1, sha256, sha512, hmac_sha1, hmac_md5, also can make md5 hash of files

Thangs to Vanilla Hsu for speed improvements and md4, sha support

Install:

way 1

1) go to the directory with hashlib library

2) execute node-waf configure build

3) get module from ./build/default/hashlib.node

You should use var hashlib = require("./build/default/hashlib"); (way to module)

way 2 (works if node are installed in default path)

1) go to the directory with hashlib library

2) execute make

3) execute sudo make install

You should use var hashlib = require("hashlib"); (from any path)

Functions:

md4(str); // Returns md4 hash from sting
md5(str); // Returns md5 hash from sting
sha(str); // Returns sha hash from sting
sha1(str); // Returns sha1 hash from sting
sha256(str); // Returns sha256 hash from sting
sha512(str); // Returns sha512 hash from sting
md6(str[, length]); // Returns md6 hash from sting, second parametr is optional
md5_file(path[, callback]); // Returns md5 hash from file callback is optional and works async
hmac_sha1(str, key) // Returns hmac sha1 hash with an key
hmac_md5(str, key) // Returns hmac md5 hash with an key

Usage:

var hashlib = require('hashlib');
hashlib.md5('text');

Speed testing

To run speed test on your computer run test.js, here is my:

C++ md5 result is: 220
JS md5 result is: 5660
C++ module faster than JS in 25.727272727272727 times
-----------
C++ md4 result is: 212
C++ md6 result is: 3889
C++ sha0 result is: 228
C++ sha1 result is: 495
C++ sha256 result is: 712
C++ sha512 result is: 612

// Smaller is better

Other modules, engines md5 comparsion:

hashlib: 220
node-crypto: 1055
python-hashlib: 265
php: 179

// Smaller is better

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server
ZW5kZW5yYWhheXU5QGdtYWlsLmNvbQ==