Browse Source

Fix for issue #214

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
9a26946aaa
  1. 16
      src/node_crypto.cc

16
src/node_crypto.cc

@ -1783,13 +1783,17 @@ class Hash : public ObjectWrap {
return ThrowException(exception); return ThrowException(exception);
} }
char* buf = new char[len];
ssize_t written = DecodeWrite(buf, len, args[0], enc);
assert(written == len);
int r = hash->HashUpdate(buf, len); if (Buffer::HasInstance(args[0])) {
Buffer *buffer = ObjectWrap::Unwrap<Buffer>(args[0]->ToObject());
delete[] buf; int r = hash->HashUpdate(buffer->data(), buffer->length());
} else {
char* buf = new char[len];
ssize_t written = DecodeWrite(buf, len, args[0], enc);
assert(written == len);
int r = hash->HashUpdate(buf, len);
delete[] buf;
}
return args.This(); return args.This();
} }

Loading…
Cancel
Save