From ed9c79e131769d060f7538664eb301d41446a3e1 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Wed, 15 Dec 2021 16:06:07 +0330 Subject: [PATCH] LibWeb: Use ByteBuffer::copy() instead of a manual copy in SubtleCrypto Also use the HashManager(HashKind) constructor instead of the default constructor + manual initialize() call. --- Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp index a77ac50bce..8835b701dc 100644 --- a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp +++ b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp @@ -59,19 +59,16 @@ JS::Promise* SubtleCrypto::digest(String const& algorithm, JS::Handleglobal_object(), DOM::OperationError::create("Failed to create result buffer")); promise->reject(error); return promise; } - for (size_t i = 0; i < hash.digest_size(); ++i) - (*result_buffer)[i] = digest_data[i]; auto* result = JS::ArrayBuffer::create(global_object, result_buffer.release_value());