Skip to content

Commit c631a71

Browse files
committed
crypto: avoid copying buffers to UTF-8 strings in crypto.hash()
1 parent 4dafa77 commit c631a71

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/crypto/crypto_hash.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@ void Hash::OneShotDigest(const FunctionCallbackInfo<Value>& args) {
275275
}
276276

277277
DataPointer output = ([&]() -> DataPointer {
278-
Utf8Value utf8(isolate, args[3]);
279278
ncrypto::Buffer<const unsigned char> buf;
280279
if (args[3]->IsString()) {
280+
Utf8Value utf8(isolate, args[3]);
281281
buf = {
282282
.data = reinterpret_cast<const unsigned char*>(utf8.out()),
283283
.len = utf8.length(),

0 commit comments

Comments
 (0)