From: Dmitry Volyntsev Date: Fri, 9 May 2025 01:03:21 +0000 (-0700) Subject: WebCrypto: making SHA-256 the default hash algorithm. X-Git-Tag: 0.9.1~45 X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=637fc26eac8622ccf8c73cfa4604e9afe54c3f34;p=njs.git WebCrypto: making SHA-256 the default hash algorithm. --- diff --git a/external/njs_webcrypto_module.c b/external/njs_webcrypto_module.c index dcca91ce..8cc172cc 100644 --- a/external/njs_webcrypto_module.c +++ b/external/njs_webcrypto_module.c @@ -4642,8 +4642,8 @@ njs_algorithm_hash(njs_vm_t *vm, njs_value_t *options, if (njs_value_is_object(options)) { val = njs_vm_object_prop(vm, options, &string_hash, &value); - if (njs_slow_path(val == NULL)) { - njs_value_undefined_set(njs_value_arg(&value)); + if (val == NULL) { + return NJS_HASH_SHA256; } } else { diff --git a/external/qjs_webcrypto_module.c b/external/qjs_webcrypto_module.c index 937f96c3..f26b6505 100644 --- a/external/qjs_webcrypto_module.c +++ b/external/qjs_webcrypto_module.c @@ -4437,6 +4437,11 @@ qjs_algorithm_hash(JSContext *cx, JSValue options, qjs_webcrypto_hash_t *hash) if (JS_IsObject(options)) { v = JS_GetPropertyStr(cx, options, "hash"); + if (JS_IsUndefined(v)) { + *hash = QJS_HASH_SHA256; + return JS_UNDEFINED; + } + if (JS_IsException(v)) { return JS_EXCEPTION; }