Giter Site home page Giter Site logo

sembiance / mhash Goto Github PK

View Code? Open in Web Editor NEW
37.0 6.0 14.0 518 KB

Provides several hashing algorithms for node.js by binding to mhash. Includes support for 27 different hash algorithms including: md5, md4, md2, sha1, sha256, whirlpool, crc32, etc.

License: The Unlicense

Python 26.50% JavaScript 8.43% Shell 2.72% C++ 62.35%

mhash's Introduction

DEPRECATED

I HIGHLY advise using the built in nodejs crypto.createHash() function instead of mhash.

Description

Provides several hashing algorithms for node.js by binding to mhash

NOTE: MacOS X users need to have XCode installed (provides gcc)

Installation with NPM

npm install mhash --python=python2

May need to manually run first to build mhash dep:

./libmhash-config.sh
./libmhash-build.sh

Usage

Syntax: hash("algo-type", String || Buffer)
//First argument is a string, one of the supported algorihms below.
//Second argument can either be a String or a Buffer.
var hash = require("mhash");

console.log(hash("md2", "testing"));

Supported Hashing Algorithms

  • crc32

  • crc32b

  • md2

  • md4

  • md5

  • haval128

  • haval160

  • haval192

  • haval224

  • haval256

  • sha1

  • sha224

  • sha256

  • sha384

  • sha512

  • ripemd128

  • ripemd160

  • ripemd256

  • ripemd320

  • tiger128

  • tiger160

  • tiger192

  • gost

  • whirlpool

  • adler32

  • snefru128

  • snefru256

Known Issues

The crc32 and crc32b may not be what you expect due the way the mhash library computes these.

See Issue #1 for more details.

Manual Installation

git clone "https://github.com/Sembiance/mhash.git"
cd mhash
node-gyp configure build

mhash's People

Contributors

lsmoura avatar mcandre avatar miguelaferreira avatar mscdex avatar sembiance avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mhash's Issues

Support for Node 0.8+

node-mhash currently relies on node-waf to build, but node-waf was replaced by node-gyp in Node v0.8. Latest Node is v0.10. Could we please update node-mhash to work with current Node versions?

node-gyp fails in El Capitan

When I try to npm install mhash (any version between 2.0.0 and 2.1.3), I get a node-gyp build failure.

Could we please fix these for Mac OS X users?

Could we rewrite mhash in pure Node.js, so that we don't depend on a rather flaky build system?

node-gyp rebuild: warnings (Mac OS X)

During npm install, when it rebuilds the C++ dependencies, it shows a few warnings.

$ npm install
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings

> [email protected] install /Users/andrew/Desktop/src/node-mhash
> node-gyp rebuild

  ACTION binding_gyp_libmhash_target_test .
Making all in include
make[2]: Nothing to be done for `all'.
Making all in lib
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT mhash.lo -MD -MP -MF ".deps/mhash.Tpo" -c -o mhash.lo mhash.c; \
    then mv -f ".deps/mhash.Tpo" ".deps/mhash.Plo"; else rm -f ".deps/mhash.Tpo"; exit 1; fi
mkdir .libs
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT mhash.lo -MD -MP -MF .deps/mhash.Tpo -c mhash.c  -fno-common -DPIC -o .libs/mhash.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT mhash.lo -MD -MP -MF .deps/mhash.Tpo -c mhash.c -o mhash.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT stdfns.lo -MD -MP -MF ".deps/stdfns.Tpo" -c -o stdfns.lo stdfns.c; \
    then mv -f ".deps/stdfns.Tpo" ".deps/stdfns.Plo"; else rm -f ".deps/stdfns.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT stdfns.lo -MD -MP -MF .deps/stdfns.Tpo -c stdfns.c  -fno-common -DPIC -o .libs/stdfns.o
stdfns.c: In function 'mutils_memcpy':
stdfns.c:227: warning: cast from pointer to integer of different size
stdfns.c:228: warning: cast from pointer to integer of different size
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT stdfns.lo -MD -MP -MF .deps/stdfns.Tpo -c stdfns.c -o stdfns.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT keygen_hex.lo -MD -MP -MF ".deps/keygen_hex.Tpo" -c -o keygen_hex.lo keygen_hex.c; \
    then mv -f ".deps/keygen_hex.Tpo" ".deps/keygen_hex.Plo"; else rm -f ".deps/keygen_hex.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT keygen_hex.lo -MD -MP -MF .deps/keygen_hex.Tpo -c keygen_hex.c  -fno-common -DPIC -o .libs/keygen_hex.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT keygen_hex.lo -MD -MP -MF .deps/keygen_hex.Tpo -c keygen_hex.c -o keygen_hex.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT keygen_mcrypt.lo -MD -MP -MF ".deps/keygen_mcrypt.Tpo" -c -o keygen_mcrypt.lo keygen_mcrypt.c; \
    then mv -f ".deps/keygen_mcrypt.Tpo" ".deps/keygen_mcrypt.Plo"; else rm -f ".deps/keygen_mcrypt.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT keygen_mcrypt.lo -MD -MP -MF .deps/keygen_mcrypt.Tpo -c keygen_mcrypt.c  -fno-common -DPIC -o .libs/keygen_mcrypt.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT keygen_mcrypt.lo -MD -MP -MF .deps/keygen_mcrypt.Tpo -c keygen_mcrypt.c -o keygen_mcrypt.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT keygen_asis.lo -MD -MP -MF ".deps/keygen_asis.Tpo" -c -o keygen_asis.lo keygen_asis.c; \
    then mv -f ".deps/keygen_asis.Tpo" ".deps/keygen_asis.Plo"; else rm -f ".deps/keygen_asis.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT keygen_asis.lo -MD -MP -MF .deps/keygen_asis.Tpo -c keygen_asis.c  -fno-common -DPIC -o .libs/keygen_asis.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT keygen_asis.lo -MD -MP -MF .deps/keygen_asis.Tpo -c keygen_asis.c -o keygen_asis.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT keygen.lo -MD -MP -MF ".deps/keygen.Tpo" -c -o keygen.lo keygen.c; \
    then mv -f ".deps/keygen.Tpo" ".deps/keygen.Plo"; else rm -f ".deps/keygen.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT keygen.lo -MD -MP -MF .deps/keygen.Tpo -c keygen.c  -fno-common -DPIC -o .libs/keygen.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT keygen.lo -MD -MP -MF .deps/keygen.Tpo -c keygen.c -o keygen.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT keygen_s2k.lo -MD -MP -MF ".deps/keygen_s2k.Tpo" -c -o keygen_s2k.lo keygen_s2k.c; \
    then mv -f ".deps/keygen_s2k.Tpo" ".deps/keygen_s2k.Plo"; else rm -f ".deps/keygen_s2k.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT keygen_s2k.lo -MD -MP -MF .deps/keygen_s2k.Tpo -c keygen_s2k.c  -fno-common -DPIC -o .libs/keygen_s2k.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT keygen_s2k.lo -MD -MP -MF .deps/keygen_s2k.Tpo -c keygen_s2k.c -o keygen_s2k.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT crc32.lo -MD -MP -MF ".deps/crc32.Tpo" -c -o crc32.lo crc32.c; \
    then mv -f ".deps/crc32.Tpo" ".deps/crc32.Plo"; else rm -f ".deps/crc32.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT crc32.lo -MD -MP -MF .deps/crc32.Tpo -c crc32.c  -fno-common -DPIC -o .libs/crc32.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT crc32.lo -MD -MP -MF .deps/crc32.Tpo -c crc32.c -o crc32.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT adler32.lo -MD -MP -MF ".deps/adler32.Tpo" -c -o adler32.lo adler32.c; \
    then mv -f ".deps/adler32.Tpo" ".deps/adler32.Plo"; else rm -f ".deps/adler32.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT adler32.lo -MD -MP -MF .deps/adler32.Tpo -c adler32.c  -fno-common -DPIC -o .libs/adler32.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT adler32.lo -MD -MP -MF .deps/adler32.Tpo -c adler32.c -o adler32.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT md2.lo -MD -MP -MF ".deps/md2.Tpo" -c -o md2.lo md2.c; \
    then mv -f ".deps/md2.Tpo" ".deps/md2.Plo"; else rm -f ".deps/md2.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT md2.lo -MD -MP -MF .deps/md2.Tpo -c md2.c  -fno-common -DPIC -o .libs/md2.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT md2.lo -MD -MP -MF .deps/md2.Tpo -c md2.c -o md2.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT md4.lo -MD -MP -MF ".deps/md4.Tpo" -c -o md4.lo md4.c; \
    then mv -f ".deps/md4.Tpo" ".deps/md4.Plo"; else rm -f ".deps/md4.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT md4.lo -MD -MP -MF .deps/md4.Tpo -c md4.c  -fno-common -DPIC -o .libs/md4.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT md4.lo -MD -MP -MF .deps/md4.Tpo -c md4.c -o md4.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT md5.lo -MD -MP -MF ".deps/md5.Tpo" -c -o md5.lo md5.c; \
    then mv -f ".deps/md5.Tpo" ".deps/md5.Plo"; else rm -f ".deps/md5.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT md5.lo -MD -MP -MF .deps/md5.Tpo -c md5.c  -fno-common -DPIC -o .libs/md5.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT md5.lo -MD -MP -MF .deps/md5.Tpo -c md5.c -o md5.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT ripemd.lo -MD -MP -MF ".deps/ripemd.Tpo" -c -o ripemd.lo ripemd.c; \
    then mv -f ".deps/ripemd.Tpo" ".deps/ripemd.Plo"; else rm -f ".deps/ripemd.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT ripemd.lo -MD -MP -MF .deps/ripemd.Tpo -c ripemd.c  -fno-common -DPIC -o .libs/ripemd.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT ripemd.lo -MD -MP -MF .deps/ripemd.Tpo -c ripemd.c -o ripemd.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT sha1.lo -MD -MP -MF ".deps/sha1.Tpo" -c -o sha1.lo sha1.c; \
    then mv -f ".deps/sha1.Tpo" ".deps/sha1.Plo"; else rm -f ".deps/sha1.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT sha1.lo -MD -MP -MF .deps/sha1.Tpo -c sha1.c  -fno-common -DPIC -o .libs/sha1.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT sha1.lo -MD -MP -MF .deps/sha1.Tpo -c sha1.c -o sha1.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT sha256_sha224.lo -MD -MP -MF ".deps/sha256_sha224.Tpo" -c -o sha256_sha224.lo sha256_sha224.c; \
    then mv -f ".deps/sha256_sha224.Tpo" ".deps/sha256_sha224.Plo"; else rm -f ".deps/sha256_sha224.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT sha256_sha224.lo -MD -MP -MF .deps/sha256_sha224.Tpo -c sha256_sha224.c  -fno-common -DPIC -o .libs/sha256_sha224.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT sha256_sha224.lo -MD -MP -MF .deps/sha256_sha224.Tpo -c sha256_sha224.c -o sha256_sha224.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT sha512_sha384.lo -MD -MP -MF ".deps/sha512_sha384.Tpo" -c -o sha512_sha384.lo sha512_sha384.c; \
    then mv -f ".deps/sha512_sha384.Tpo" ".deps/sha512_sha384.Plo"; else rm -f ".deps/sha512_sha384.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT sha512_sha384.lo -MD -MP -MF .deps/sha512_sha384.Tpo -c sha512_sha384.c  -fno-common -DPIC -o .libs/sha512_sha384.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT sha512_sha384.lo -MD -MP -MF .deps/sha512_sha384.Tpo -c sha512_sha384.c -o sha512_sha384.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT tiger.lo -MD -MP -MF ".deps/tiger.Tpo" -c -o tiger.lo tiger.c; \
    then mv -f ".deps/tiger.Tpo" ".deps/tiger.Plo"; else rm -f ".deps/tiger.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT tiger.lo -MD -MP -MF .deps/tiger.Tpo -c tiger.c  -fno-common -DPIC -o .libs/tiger.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT tiger.lo -MD -MP -MF .deps/tiger.Tpo -c tiger.c -o tiger.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT tiger_sboxes.lo -MD -MP -MF ".deps/tiger_sboxes.Tpo" -c -o tiger_sboxes.lo tiger_sboxes.c; \
    then mv -f ".deps/tiger_sboxes.Tpo" ".deps/tiger_sboxes.Plo"; else rm -f ".deps/tiger_sboxes.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT tiger_sboxes.lo -MD -MP -MF .deps/tiger_sboxes.Tpo -c tiger_sboxes.c  -fno-common -DPIC -o .libs/tiger_sboxes.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT tiger_sboxes.lo -MD -MP -MF .deps/tiger_sboxes.Tpo -c tiger_sboxes.c -o tiger_sboxes.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT haval.lo -MD -MP -MF ".deps/haval.Tpo" -c -o haval.lo haval.c; \
    then mv -f ".deps/haval.Tpo" ".deps/haval.Plo"; else rm -f ".deps/haval.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT haval.lo -MD -MP -MF .deps/haval.Tpo -c haval.c  -fno-common -DPIC -o .libs/haval.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT haval.lo -MD -MP -MF .deps/haval.Tpo -c haval.c -o haval.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT gosthash.lo -MD -MP -MF ".deps/gosthash.Tpo" -c -o gosthash.lo gosthash.c; \
    then mv -f ".deps/gosthash.Tpo" ".deps/gosthash.Plo"; else rm -f ".deps/gosthash.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT gosthash.lo -MD -MP -MF .deps/gosthash.Tpo -c gosthash.c  -fno-common -DPIC -o .libs/gosthash.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT gosthash.lo -MD -MP -MF .deps/gosthash.Tpo -c gosthash.c -o gosthash.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT whirlpool.lo -MD -MP -MF ".deps/whirlpool.Tpo" -c -o whirlpool.lo whirlpool.c; \
    then mv -f ".deps/whirlpool.Tpo" ".deps/whirlpool.Plo"; else rm -f ".deps/whirlpool.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT whirlpool.lo -MD -MP -MF .deps/whirlpool.Tpo -c whirlpool.c  -fno-common -DPIC -o .libs/whirlpool.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT whirlpool.lo -MD -MP -MF .deps/whirlpool.Tpo -c whirlpool.c -o whirlpool.o >/dev/null 2>&1
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT snefru.lo -MD -MP -MF ".deps/snefru.Tpo" -c -o snefru.lo snefru.c; \
    then mv -f ".deps/snefru.Tpo" ".deps/snefru.Plo"; else rm -f ".deps/snefru.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT snefru.lo -MD -MP -MF .deps/snefru.Tpo -c snefru.c  -fno-common -DPIC -o .libs/snefru.o
 gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils -I../include -fPIC -g -O2 -MT snefru.lo -MD -MP -MF .deps/snefru.Tpo -c snefru.c -o snefru.o >/dev/null 2>&1
/bin/sh ../libtool --tag=CC --mode=link gcc  -g -O2   -o libmhash.la -rpath /usr/local/lib -version-info 2:1 mhash.lo stdfns.lo keygen_hex.lo keygen_mcrypt.lo keygen_asis.lo keygen.lo keygen_s2k.lo crc32.lo adler32.lo md2.lo md4.lo md5.lo ripemd.lo sha1.lo sha256_sha224.lo sha512_sha384.lo tiger.lo tiger_sboxes.lo haval.lo gosthash.lo whirlpool.lo snefru.lo  
gcc -dynamiclib ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/libmhash.2.0.1.dylib  .libs/mhash.o .libs/stdfns.o .libs/keygen_hex.o .libs/keygen_mcrypt.o .libs/keygen_asis.o .libs/keygen.o .libs/keygen_s2k.o .libs/crc32.o .libs/adler32.o .libs/md2.o .libs/md4.o .libs/md5.o .libs/ripemd.o .libs/sha1.o .libs/sha256_sha224.o .libs/sha512_sha384.o .libs/tiger.o .libs/tiger_sboxes.o .libs/haval.o .libs/gosthash.o .libs/whirlpool.o .libs/snefru.o   -install_name  /usr/local/lib/libmhash.2.dylib -Wl,-compatibility_version -Wl,3 -Wl,-current_version -Wl,3.1
(cd .libs && rm -f libmhash.2.dylib && ln -s libmhash.2.0.1.dylib libmhash.2.dylib)
(cd .libs && rm -f libmhash.dylib && ln -s libmhash.2.0.1.dylib libmhash.dylib)
ar cru .libs/libmhash.a  mhash.o stdfns.o keygen_hex.o keygen_mcrypt.o keygen_asis.o keygen.o keygen_s2k.o crc32.o adler32.o md2.o md4.o md5.o ripemd.o sha1.o sha256_sha224.o sha512_sha384.o tiger.o tiger_sboxes.o haval.o gosthash.o whirlpool.o snefru.o
ranlib .libs/libmhash.a
creating libmhash.la
(cd .libs && rm -f libmhash.la && ln -s ../libmhash.la libmhash.la)
Making all in doc
make[2]: Nothing to be done for `all'.
Making all in src
if gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT driver.o -MD -MP -MF ".deps/driver.Tpo" -c -o driver.o driver.c; \
    then mv -f ".deps/driver.Tpo" ".deps/driver.Po"; else rm -f ".deps/driver.Tpo"; exit 1; fi
/bin/sh ../libtool --tag=CC --mode=link gcc  -g -O2   -o driver  driver.o ../lib/libmhash.la 
mkdir .libs
gcc -g -O2 -o .libs/driver driver.o  ../lib/.libs/libmhash.dylib
creating driver
if gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT hmac_test.o -MD -MP -MF ".deps/hmac_test.Tpo" -c -o hmac_test.o hmac_test.c; \
    then mv -f ".deps/hmac_test.Tpo" ".deps/hmac_test.Po"; else rm -f ".deps/hmac_test.Tpo"; exit 1; fi
/bin/sh ../libtool --tag=CC --mode=link gcc  -g -O2   -o hmac_test  hmac_test.o ../lib/libmhash.la 
gcc -g -O2 -o .libs/hmac_test hmac_test.o  ../lib/.libs/libmhash.dylib
creating hmac_test
if gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT keygen_test.o -MD -MP -MF ".deps/keygen_test.Tpo" -c -o keygen_test.o keygen_test.c; \
    then mv -f ".deps/keygen_test.Tpo" ".deps/keygen_test.Po"; else rm -f ".deps/keygen_test.Tpo"; exit 1; fi
/bin/sh ../libtool --tag=CC --mode=link gcc  -g -O2   -o keygen_test  keygen_test.o ../lib/libmhash.la 
gcc -g -O2 -o .libs/keygen_test keygen_test.o  ../lib/.libs/libmhash.dylib
creating keygen_test
if gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT mhash_save_restore_test.o -MD -MP -MF ".deps/mhash_save_restore_test.Tpo" -c -o mhash_save_restore_test.o mhash_save_restore_test.c; \
    then mv -f ".deps/mhash_save_restore_test.Tpo" ".deps/mhash_save_restore_test.Po"; else rm -f ".deps/mhash_save_restore_test.Tpo"; exit 1; fi
/bin/sh ../libtool --tag=CC --mode=link gcc  -g -O2   -o rest_test  mhash_save_restore_test.o ../lib/libmhash.la 
gcc -g -O2 -o .libs/rest_test mhash_save_restore_test.o  ../lib/.libs/libmhash.dylib
creating rest_test
if gcc -DHAVE_CONFIG_H -I. -I. -I../include/mutils  -I../include -fPIC  -g -O2 -MT frag_test.o -MD -MP -MF ".deps/frag_test.Tpo" -c -o frag_test.o frag_test.c; \
    then mv -f ".deps/frag_test.Tpo" ".deps/frag_test.Po"; else rm -f ".deps/frag_test.Tpo"; exit 1; fi
/bin/sh ../libtool --tag=CC --mode=link gcc  -g -O2   -o frag_test  frag_test.o ../lib/libmhash.la 
gcc -g -O2 -o .libs/frag_test frag_test.o  ../lib/.libs/libmhash.dylib
creating frag_test
make[2]: Nothing to be done for `all-am'.
  TOUCH Release/obj.target/libmhash.stamp
  CXX(target) Release/obj.target/mhash/mhash.o
../mhash.cc:37:11: warning: comparison of integers of different signs: 'int' and
      'unsigned long' [-Wsign-compare]
        for(i=0;i<len;i++)
                ~^~~~
../mhash.cc:146:10: warning: variable 'hashed' is used uninitialized whenever 'if'
      condition is false [-Wsometimes-uninitialized]
        else if(Buffer::HasInstance(args[1]))
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../mhash.cc:152:6: note: uninitialized use occurs here
        if(!hashed)
            ^~~~~~
../mhash.cc:146:7: note: remove the 'if' if its condition is always true
        else if(Buffer::HasInstance(args[1]))
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../mhash.cc:133:17: note: initialize the variable 'hashed' to silence this warning
        char *                  hashed;
                                      ^
                                       = NULL
2 warnings generated.
  SOLINK_MODULE(target) Release/mhash.node
  SOLINK_MODULE(target) Release/mhash.node: Finished
[email protected] node_modules/bindings

Building on freebsd with clang++

Hi, found strange issue with mhash on freebsd.

First of all I know that there is a node-gyp issue, described here #11 and I have created symlink to clang++:

ls -la /usr/bin/g++
lrwxr-xr-x  1 root  wheel  16 19 feb 09:56 /usr/bin/g++ -> /usr/bin/clang++

But now, I've got another issue, here is a build-log: https://gist.github.com/josser/d3e4524be46afccc5227

I'm not familiar with c++ so if there are any things I missed, feel free to ask.
Thanks, and sorry for my bad english :)

crc32 values are wrong?

var hash = require("mhash").hash;
hash("crc32", "alejandro");
// '1c7af1b5'
hash("crc32b", "alejandro");
// '4fa1c5aa'

I believe the response should be AAC5A14F for crc32. I've tried this in ruby, php, and two online sources and they all agree. The expected decimal value would then be 2865078607 .

This package gets it right: https://npmjs.org/package/crc32

Let me know if I'm calling it wrong though or doing something else that's obvious. FYI, I'm on a 64-bit version of node.

Support for node 0.12

Hi guys I'm having issues when installing mash in Node 0.12.0

../mhash.cc:129:2: error: use of undeclared identifier 'NanScope'
        NanScope();
        ^
../mhash.cc:134:26: error: use of undeclared identifier 'args'; did you mean 'uv_process_options_s::args'?
        String::Utf8Value       name(args[0]->ToString());
                                     ^~~~
                                     uv_process_options_s::args
/Users/marman/.node-gyp/0.12.0/deps/uv/include/uv.h:822:10: note: 'uv_process_options_s::args' declared here
  char** args;
         ^
../mhash.cc:134:26: error: invalid use of non-static data member 'args'
        String::Utf8Value       name(args[0]->ToString());
                                     ^~~~
../mhash.cc:137:18: error: use of undeclared identifier 'NanNull'
                NanReturnValue(NanNull());
                               ^
../mhash.cc:139:5: error: use of undeclared identifier 'args'; did you mean 'uv_process_options_s::args'?
        if(args[1]->IsString())
           ^~~~
           uv_process_options_s::args
/Users/marman/.node-gyp/0.12.0/deps/uv/include/uv.h:822:10: note: 'uv_process_options_s::args' declared here
  char** args;
         ^
../mhash.cc:139:5: error: invalid use of non-static data member 'args'
        if(args[1]->IsString())
           ^~~~
../mhash.cc:141:27: error: use of undeclared identifier 'args'; did you mean 'uv_process_options_s::args'?
                String::Utf8Value       data(args[1]->ToString());
                                             ^~~~
                                             uv_process_options_s::args
/Users/marman/.node-gyp/0.12.0/deps/uv/include/uv.h:822:10: note: 'uv_process_options_s::args' declared here
  char** args;
         ^
../mhash.cc:141:27: error: invalid use of non-static data member 'args'
                String::Utf8Value       data(args[1]->ToString());
                                             ^~~~
../mhash.cc:144:36: error: use of undeclared identifier 'args'; did you mean 'uv_process_options_s::args'?
        else if(node::Buffer::HasInstance(args[1]))
                                          ^~~~
                                          uv_process_options_s::args
/Users/marman/.node-gyp/0.12.0/deps/uv/include/uv.h:822:10: note: 'uv_process_options_s::args' declared here
  char** args;
         ^
../mhash.cc:144:36: error: invalid use of non-static data member 'args'
        else if(node::Buffer::HasInstance(args[1]))
                                          ^~~~
../mhash.cc:146:25: error: use of undeclared identifier 'args'; did you mean 'uv_process_options_s::args'?
                Handle<Object> data = args[1]->ToObject();
                                      ^~~~
                                      uv_process_options_s::args
/Users/marman/.node-gyp/0.12.0/deps/uv/include/uv.h:822:10: note: 'uv_process_options_s::args' declared here
  char** args;
         ^
../mhash.cc:146:25: error: invalid use of non-static data member 'args'
                Handle<Object> data = args[1]->ToObject();
                                      ^~~~
../mhash.cc:151:18: error: use of undeclared identifier 'NanNull'
                NanReturnValue(NanNull());
                               ^
../mhash.cc:153:8: error: use of undeclared identifier 'NanNew'
        ret = NanNew<String>(hashed);
              ^
../mhash.cc:153:15: error: 'String' does not refer to a value
        ret = NanNew<String>(hashed);
                     ^
/Users/marman/.node-gyp/0.12.0/deps/v8/include/v8.h:1599:17: note: declared here
class V8_EXPORT String : public Primitive {
                ^
../mhash.cc:156:2: error: use of undeclared identifier 'NanReturnValue'
        NanReturnValue(ret);
        ^
../mhash.cc:161:15: error: use of undeclared identifier 'NanNew'
        exports->Set(NanNew("hash"), NanNew<FunctionTemplate>(Hash)->GetFunction());
                     ^
../mhash.cc:161:31: error: use of undeclared identifier 'NanNew'
        exports->Set(NanNew("hash"), NanNew<FunctionTemplate>(Hash)->GetFunction());
                                     ^
../mhash.cc:161:38: error: 'FunctionTemplate' does not refer to a value
        exports->Set(NanNew("hash"), NanNew<FunctionTemplate>(Hash)->GetFunction());
                                            ^
/Users/marman/.node-gyp/0.12.0/deps/v8/include/v8.h:3452:17: note: declared here
class V8_EXPORT FunctionTemplate : public Template {
                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/mhash/mhash.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/marman/.nvm/versions/node/v0.12.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1067:12)
gyp ERR! System Darwin 14.4.0
gyp ERR! command "node" "/Users/marman/.nvm/versions/node/v0.12.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/marman/Projects/selfie-api/node_modules/mhash
gyp ERR! node -v v0.12.0
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok 
npm ERR! Darwin 14.4.0
npm ERR! argv "/Users/marman/.nvm/versions/node/v0.12.0/bin/node" "/Users/marman/.nvm/versions/node/v0.12.0/bin/npm" "install" "mhash" "--python=python2" "--save"
npm ERR! node v0.12.0
npm ERR! npm  v2.5.1
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the mhash package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls mhash
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/marman/Projects/selfie-api/npm-debug.log

Node v0.12.0
NPM 2.5.1

Any idea ?

Add windows support

node-waf has been replaced by node-gyp, which adds Windows compatibility.

If we swap out node-waf for node-gyp, we should be able to provide node-mhash in Windows environments!

Compilation breaks in Node.js v0.12, v4, v6

When using the more recent Node.js versions v0.12, v4, or v6, node-gyp presents errors during compilation of the mhash wrapper, due to how the Node.js engine C API has changed over time :/

Build failed on FreeBSD 10

Hi!
Trying to install mhash on freebsd 10 but got strange error:

 LC_ALL=C npm install mhash
npm http GET https://registry.npmjs.org/mhash
npm http 304 https://registry.npmjs.org/mhash
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings

> [email protected] install /usr/home/josser/Projects/tailorbet/hosteduic/node_modules/mhash
> node-gyp rebuild

gmake: Entering directory `/usr/home/josser/Projects/tailorbet/hosteduic/node_modules/mhash/build'
  ACTION binding_gyp_libmhash_target_test .
make[1]: don't know how to make wr. Stop

make[1]: stopped in /usr/home/josser/Projects/tailorbet/hosteduic/node_modules/mhash/deps/mhash
  TOUCH Release/obj.target/libmhash.stamp
  CXX(target) Release/obj.target/mhash/mhash.o
gmake: g++: Command not found
gmake: *** [Release/obj.target/mhash/mhash.o] Error 127
gmake: Leaving directory `/usr/home/josser/Projects/tailorbet/hosteduic/node_modules/mhash/build'
gyp ERR! build error 
gyp ERR! stack Error: `gmake` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System FreeBSD 10.0-RELEASE
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/home/josser/Projects/tailorbet/hosteduic/node_modules/mhash
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok 
npm ERR! weird error 1
npm ERR! not ok code 0

FreBSD 10 came with clang instead of GCC so I tried to force CXX to c++:

CXX=c++ npm install mhash
npm http GET https://registry.npmjs.org/mhash
npm http 304 https://registry.npmjs.org/mhash
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings

> [email protected] install /usr/home/josser/Projects/tailorbet/hosteduic/node_modules/mhash
> node-gyp rebuild

gmake: Entering directory `/usr/home/josser/Projects/tailorbet/hosteduic/node_modules/mhash/build'
  ACTION binding_gyp_libmhash_target_test .
make[1]: don't know how to make wr. Stop

make[1]: stopped in /usr/home/josser/Projects/tailorbet/hosteduic/node_modules/mhash/deps/mhash
  TOUCH Release/obj.target/libmhash.stamp
  CXX(target) Release/obj.target/mhash/mhash.o
In file included from ../mhash.cc:6:
In file included from ../deps/mhash/include/mhash.h:6:
../deps/mhash/include/mutils/mincludes.h:34:10: fatal error: 'mutils/mhash_config.h' file not found
#include <mutils/mhash_config.h>
         ^
1 error generated.
gmake: *** [Release/obj.target/mhash/mhash.o] Error 1
gmake: Leaving directory `/usr/home/josser/Projects/tailorbet/hosteduic/node_modules/mhash/build'
gyp ERR! build error 
gyp ERR! stack Error: `gmake` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System FreeBSD 10.0-RELEASE
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/home/josser/Projects/tailorbet/hosteduic/node_modules/mhash
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok 
npm ERR! weird error 1
npm ERR! not ok code 0

Looks like it can't find header files, which is located at: /usr/local/include/mutils/mhash_config.h
I have this file but I don't know how to specify path to it.

Thanks, and sorry for bad english.

Unit test failing in Mac OS X

When I run npm test in Mac OS X, it fails.

$ npm test

> [email protected] test /Users/andrew/Desktop/src/node-mhash
> node test.js

fc134df10d6ecafceb5c75861d01b41f

Next should be: 0c1e02ff
0c1e02ff

System:

$ specs node os
Specs:

specs 0.4
https://github.com/mcandre/specs#readme

npm --version
1.2.18

node --version
v0.10.5

system_profiler SPSoftwareDataType | grep 'System Version'
      System Version: OS X 10.8.3 (12D78)

Support for Node.js v0.11

mhash works great in Node.js v0.10, but when I upgrade to Node.js v0.11.0, mhash can no longer compile.

Get tiger192,3 hash

Hello, I'm trying to get the same hash using mhash and php with tiger192. I tried to do 3 rounds using mhash but the results are different. Is there an easy way to do this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.