| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 324d9fc commit 135fca5
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -274,26 +274,23 @@ void Hash::OneShotDigest(const FunctionCallbackInfo<Value>& args) { | |||
| 274 | 274 | } | |
| 275 | 275 | ||
| 276 | 276 | DataPointer output = ([&]() -> DataPointer { | |
| 277 | - Utf8Value utf8(isolate, args[3]); | ||
| 278 | - ncrypto::Buffer<const unsigned char> buf; | ||
| 279 | 277 | if (args[3]->IsString()) { | |
| 280 | - buf = { | ||
| 278 | + Utf8Value utf8(isolate, args[3]); | ||
| 279 | + ncrypto::Buffer<const unsigned char> buf = { | ||
| 281 | 280 | .data = reinterpret_cast<const unsigned char*>(utf8.out()), | |
| 282 | 281 | .len = utf8.length(), | |
| 283 | 282 | }; | |
| 284 | - } else { | ||
| 285 | - ArrayBufferViewContents<unsigned char> input(args[3]); | ||
| 286 | - buf = { | ||
| 287 | - .data = reinterpret_cast<const unsigned char*>(input.data()), | ||
| 288 | - .len = input.length(), | ||
| 289 | - }; | ||
| 290 | - } | ||
| 291 | - | ||
| 292 | - if (is_xof) { | ||
| 293 | - return ncrypto::xofHashDigest(buf, md, output_length); | ||
| 283 | + return is_xof ? ncrypto::xofHashDigest(buf, md, output_length) | ||
| 284 | + : ncrypto::hashDigest(buf, md); | ||
| 294 | 285 | } | |
| 295 | 286 | ||
| 296 | - return ncrypto::hashDigest(buf, md); | ||
| 287 | + ArrayBufferViewContents<unsigned char> input(args[3]); | ||
| 288 | + ncrypto::Buffer<const unsigned char> buf = { | ||
| 289 | + .data = reinterpret_cast<const unsigned char*>(input.data()), | ||
| 290 | + .len = input.length(), | ||
| 291 | + }; | ||
| 292 | + return is_xof ? ncrypto::xofHashDigest(buf, md, output_length) | ||
| 293 | + : ncrypto::hashDigest(buf, md); | ||
| 297 | 294 | })(); | |
| 298 | 295 | ||
| 299 | 296 | if (!output) [[unlikely]] { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments