cfsolve 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/THIRD_PARTY_LICENSES/README.md +71 -254
- data/THIRD_PARTY_LICENSES/{derive_builder_macro-0.20.2/LICENSE-APACHE → bytecount-0.6.9/LICENSE.Apache2} +0 -1
- data/THIRD_PARTY_LICENSES/{darling-0.20.11/LICENSE → bytecount-0.6.9/LICENSE.MIT} +1 -3
- data/THIRD_PARTY_LICENSES/{ident_case-1.0.1/LICENSE → cobs-0.3.0/LICENSE-MIT} +1 -1
- data/THIRD_PARTY_LICENSES/cow-utils-0.1.3/LICENSE +21 -0
- data/THIRD_PARTY_LICENSES/{hashbrown-0.14.5 → embedded-io-0.4.0}/LICENSE-MIT +1 -1
- data/THIRD_PARTY_LICENSES/{ahash-0.8.12 → embedded-io-0.6.1}/LICENSE-MIT +1 -1
- data/THIRD_PARTY_LICENSES/{browserslist-data-0.1.4 → escape-simd-0.1.1}/LICENSE +1 -1
- data/THIRD_PARTY_LICENSES/escape-simd-0.1.1/NOTICE +62 -0
- data/THIRD_PARTY_LICENSES/json-escape-simd-3.1.3/LICENSE +21 -0
- data/THIRD_PARTY_LICENSES/{miette-7.6.0/LICENSE → json-escape-simd-3.1.3/LICENSE-APACHE} +0 -1
- data/THIRD_PARTY_LICENSES/json-escape-simd-3.1.3/NOTICE +62 -0
- data/THIRD_PARTY_LICENSES/memchr-2.8.3/UNLICENSE +24 -0
- data/THIRD_PARTY_LICENSES/{derive_builder_core-0.20.2 → nonmax-0.5.5}/LICENSE-APACHE +1 -2
- data/THIRD_PARTY_LICENSES/{dashmap-5.5.3/LICENSE → nonmax-0.5.5/LICENSE-MIT} +2 -4
- data/THIRD_PARTY_LICENSES/{rand-0.8.5 → num-bigint-0.5.1}/LICENSE-MIT +0 -1
- data/THIRD_PARTY_LICENSES/oxc-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/{browserslist-rs-0.19.0 → oxc-browserslist-5.0.1}/LICENSE +1 -0
- data/THIRD_PARTY_LICENSES/oxc_allocator-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_allocator-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ast-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ast-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_macros-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_macros-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_visit-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_visit-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_codegen-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_codegen-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_compat-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_compat-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_data_structures-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_data_structures-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_diagnostics-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_diagnostics-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ecmascript-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ecmascript-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_estree-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_estree-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_index-5.0.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_parser-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_parser-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_regular_expression-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_regular_expression-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_semantic-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_semantic-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_span-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_span-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_str-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_str-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_syntax-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_syntax-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/{fixedbitset-0.5.7 → postcard-1.1.3}/LICENSE-MIT +1 -1
- data/THIRD_PARTY_LICENSES/{bytes-str-0.2.7/LICENSE → self_cell-1.3.0/LICENSE-APACHE} +1 -2
- data/THIRD_PARTY_LICENSES/self_cell-1.3.0/LICENSE-GPLv2 +339 -0
- data/THIRD_PARTY_LICENSES/{darling_core-0.20.11 → smawk-0.3.3}/LICENSE +1 -1
- data/UPSTREAM.md +7 -5
- data/ext/cfsolve/Cargo.lock +534 -1727
- data/ext/cfsolve/Cargo.toml +4 -0
- data/ext/cfsolve/src/main.rs +1 -1
- data/lib/cfsolve/profiles/safari-26-ios/answers.json +266 -265
- data/lib/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +312 -312
- data/lib/cfsolve/profiles/safari-26-ios.json +106 -152
- data/lib/cfsolve/version.rb +2 -2
- data/vendor/cfsolve/Cargo.lock +561 -1729
- data/vendor/cfsolve/Cargo.toml +26 -8
- data/vendor/cfsolve/README.md +4 -0
- data/vendor/cfsolve/examples/check_answers.rs +2 -2
- data/vendor/cfsolve/examples/compare_session.rs +1 -2
- data/vendor/cfsolve/examples/solver_profile.rs +84 -0
- data/vendor/cfsolve/examples/solver_smoke.rs +9 -8
- data/vendor/cfsolve/examples/stage2_snapshot.rs +2 -2
- data/vendor/cfsolve/examples/tls_echo.rs +3 -3
- data/vendor/cfsolve/examples/vm_snapshot.rs +32 -33
- data/vendor/cfsolve/profiles/safari-26-ios/answers.json +266 -265
- data/vendor/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +312 -312
- data/vendor/cfsolve/profiles/safari-26-ios.json +106 -152
- data/vendor/cfsolve/src/bin/capture-proxy/main.rs +3 -2
- data/vendor/cfsolve/src/bin/challenge/cli.rs +8 -2
- data/vendor/cfsolve/src/bin/challenge/main.rs +7 -2
- data/vendor/cfsolve/src/capture/proxy/tests.rs +1 -1
- data/vendor/cfsolve/src/capture/proxy.rs +44 -13
- data/vendor/cfsolve/src/capture/sessions.rs +4 -3
- data/vendor/cfsolve/src/capture/upstream.rs +1 -1
- data/vendor/cfsolve/src/challenge/codec.rs +4 -2
- data/vendor/cfsolve/src/challenge/expression.rs +161 -117
- data/vendor/cfsolve/src/challenge/installed/audit.rs +11 -10
- data/vendor/cfsolve/src/challenge/installed.rs +13 -6
- data/vendor/cfsolve/src/challenge/merge.rs +120 -80
- data/vendor/cfsolve/src/challenge/orchestrator.rs +57 -44
- data/vendor/cfsolve/src/challenge/payload.rs +69 -31
- data/vendor/cfsolve/src/challenge/program.rs +197 -178
- data/vendor/cfsolve/src/challenge/reduced_timing.rs +55 -40
- data/vendor/cfsolve/src/challenge/source.rs +151 -96
- data/vendor/cfsolve/src/challenge/state.rs +180 -148
- data/vendor/cfsolve/src/challenge/tally.rs +64 -50
- data/vendor/cfsolve/src/challenge.rs +1 -0
- data/vendor/cfsolve/src/deobfuscate/analysis/bindings.rs +187 -185
- data/vendor/cfsolve/src/deobfuscate/analysis/effects.rs +42 -51
- data/vendor/cfsolve/src/deobfuscate/analysis/hoisting.rs +147 -228
- data/vendor/cfsolve/src/deobfuscate/analysis/properties.rs +250 -425
- data/vendor/cfsolve/src/deobfuscate/analysis/unconditional.rs +79 -0
- data/vendor/cfsolve/src/deobfuscate/analysis.rs +259 -41
- data/vendor/cfsolve/src/deobfuscate/argument_arrays.rs +70 -73
- data/vendor/cfsolve/src/deobfuscate/arrow_blocks.rs +91 -104
- data/vendor/cfsolve/src/deobfuscate/ast.rs +383 -0
- data/vendor/cfsolve/src/deobfuscate/bitwise.rs +44 -54
- data/vendor/cfsolve/src/deobfuscate/blocks.rs +36 -29
- data/vendor/cfsolve/src/deobfuscate/call_helpers.rs +80 -131
- data/vendor/cfsolve/src/deobfuscate/control_flow.rs +239 -297
- data/vendor/cfsolve/src/deobfuscate/copy_propagation.rs +114 -135
- data/vendor/cfsolve/src/deobfuscate/dead_branches.rs +62 -61
- data/vendor/cfsolve/src/deobfuscate/dead_properties.rs +197 -214
- data/vendor/cfsolve/src/deobfuscate/dispatch.rs +238 -298
- data/vendor/cfsolve/src/deobfuscate/encoded_strings.rs +198 -203
- data/vendor/cfsolve/src/deobfuscate/function_lengths.rs +32 -38
- data/vendor/cfsolve/src/deobfuscate/helper_objects.rs +338 -513
- data/vendor/cfsolve/src/deobfuscate/hygiene.rs +197 -0
- data/vendor/cfsolve/src/deobfuscate/int32_helpers.rs +121 -155
- data/vendor/cfsolve/src/deobfuscate/literals.rs +116 -67
- data/vendor/cfsolve/src/deobfuscate/loops.rs +43 -43
- data/vendor/cfsolve/src/deobfuscate/memoized_strings.rs +127 -131
- data/vendor/cfsolve/src/deobfuscate/merged_functions.rs +262 -220
- data/vendor/cfsolve/src/deobfuscate/pipeline.rs +199 -244
- data/vendor/cfsolve/src/deobfuscate/register_arrays.rs +353 -327
- data/vendor/cfsolve/src/deobfuscate/removal.rs +83 -52
- data/vendor/cfsolve/src/deobfuscate/simplify.rs +147 -0
- data/vendor/cfsolve/src/deobfuscate/state_machines.rs +88 -110
- data/vendor/cfsolve/src/deobfuscate/statements.rs +228 -228
- data/vendor/cfsolve/src/deobfuscate/static_members.rs +46 -31
- data/vendor/cfsolve/src/deobfuscate/testing.rs +49 -59
- data/vendor/cfsolve/src/deobfuscate/unused_bindings.rs +92 -102
- data/vendor/cfsolve/src/deobfuscate.rs +15 -11
- data/vendor/cfsolve/src/embedding_page/extra_params.rs +23 -18
- data/vendor/cfsolve/src/embedding_page/render_sample.rs +184 -147
- data/vendor/cfsolve/src/error.rs +40 -5
- data/vendor/cfsolve/src/fingerprint.rs +8 -2
- data/vendor/cfsolve/src/http/client.rs +7 -10
- data/vendor/cfsolve/src/http/requests.rs +2 -2
- data/vendor/cfsolve/src/js/ast.rs +479 -263
- data/vendor/cfsolve/src/lib.rs +1 -0
- data/vendor/cfsolve/src/listing/fold.rs +19 -9
- data/vendor/cfsolve/src/listing/query.rs +1 -47
- data/vendor/cfsolve/src/performance_clock.rs +20 -1
- data/vendor/cfsolve/src/profiling.rs +49 -0
- data/vendor/cfsolve/src/script.rs +35 -24
- data/vendor/cfsolve/src/session/challenge_page.rs +41 -21
- data/vendor/cfsolve/src/session/channel.rs +2 -2
- data/vendor/cfsolve/src/session/initial.rs +5 -5
- data/vendor/cfsolve/src/session/sink.rs +26 -1
- data/vendor/cfsolve/src/session/tests/challenge_page.rs +36 -1
- data/vendor/cfsolve/src/session.rs +1 -1
- data/vendor/cfsolve/src/solver.rs +3 -1
- data/vendor/cfsolve/src/stage2/analysis/audit.rs +4 -2
- data/vendor/cfsolve/src/stage2/analysis/envelope.rs +2 -1
- data/vendor/cfsolve/src/stage2/audit_globals.rs +142 -74
- data/vendor/cfsolve/src/stage2/benchmark.rs +62 -31
- data/vendor/cfsolve/src/stage2/call_stack.rs +1415 -1025
- data/vendor/cfsolve/src/stage2/challenge_page.rs +3 -2
- data/vendor/cfsolve/src/stage2/interaction/checkbox.rs +202 -150
- data/vendor/cfsolve/src/stage2/interaction/click.rs +2 -2
- data/vendor/cfsolve/src/stage2/interaction/plan.rs +5 -4
- data/vendor/cfsolve/src/stage2/payload/recover.rs +2 -2
- data/vendor/cfsolve/src/stage2/probes/clock.rs +1 -3
- data/vendor/cfsolve/src/stage2/probes/performance.rs +12 -8
- data/vendor/cfsolve/src/stage2/queries.rs +50 -0
- data/vendor/cfsolve/src/stage2/syntax.rs +88 -0
- data/vendor/cfsolve/src/stage2/trace.rs +134 -108
- data/vendor/cfsolve/src/stage2/vocabulary.rs +1 -11
- data/vendor/cfsolve/src/stage2.rs +2 -0
- data/vendor/cfsolve/src/vm/disassemble.rs +7 -3
- data/vendor/cfsolve/src/vm/dispatch.rs +93 -65
- data/vendor/cfsolve/src/vm/extract.rs +347 -250
- data/vendor/cfsolve/src/vm/interpret/access.rs +63 -48
- data/vendor/cfsolve/src/vm/interpret/builtin.rs +10 -10
- data/vendor/cfsolve/src/vm/interpret/call.rs +116 -52
- data/vendor/cfsolve/src/vm/interpret/compile.rs +79 -62
- data/vendor/cfsolve/src/vm/interpret/copies.rs +2 -2
- data/vendor/cfsolve/src/vm/interpret/evaluate/tests.rs +63 -42
- data/vendor/cfsolve/src/vm/interpret/evaluate.rs +65 -575
- data/vendor/cfsolve/src/vm/interpret/explore.rs +7 -10
- data/vendor/cfsolve/src/vm/interpret/formula.rs +131 -0
- data/vendor/cfsolve/src/vm/interpret/frozen.rs +3 -5
- data/vendor/cfsolve/src/vm/interpret/intrinsic.rs +123 -59
- data/vendor/cfsolve/src/vm/interpret/mix32.rs +189 -0
- data/vendor/cfsolve/src/vm/interpret/native_dispatch.rs +220 -0
- data/vendor/cfsolve/src/vm/interpret/pattern.rs +1736 -0
- data/vendor/cfsolve/src/vm/interpret/plan.rs +586 -338
- data/vendor/cfsolve/src/vm/interpret/register_helpers.rs +384 -0
- data/vendor/cfsolve/src/vm/interpret/run.rs +116 -45
- data/vendor/cfsolve/src/vm/interpret/semantics.rs +71 -46
- data/vendor/cfsolve/src/vm/interpret/setup.rs +80 -45
- data/vendor/cfsolve/src/vm/interpret/string_decoder.rs +482 -0
- data/vendor/cfsolve/src/vm/interpret.rs +9 -1
- data/vendor/cfsolve/src/vm/machine.rs +56 -49
- data/vendor/cfsolve/src/vm/output.rs +13 -5
- data/vendor/cfsolve/src/vm/packed_names.rs +11 -7
- data/vendor/cfsolve/src/vm/session.rs +185 -120
- data/vendor/cfsolve/src/vm/value.rs +22 -19
- data/vendor/cfsolve/src/vm.rs +2 -1
- data/vendor/cfsolve/vendor/btls-sys/Cargo.toml +3 -0
- data/vendor/cfsolve/vendor/btls-sys/build/main.rs +20 -0
- metadata +94 -178
- data/THIRD_PARTY_LICENSES/Inflector-0.11.4/LICENSE.md +0 -22
- data/THIRD_PARTY_LICENSES/arrayvec-0.7.6/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/ascii-1.1.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/ascii-1.1.0/LICENSE-MIT +0 -22
- data/THIRD_PARTY_LICENSES/ast_node-5.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/better_scoped_tls-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/bitvec-1.0.1/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/bstr-1.12.1/COPYING +0 -8
- data/THIRD_PARTY_LICENSES/bstr-1.12.1/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/cargo-platform-0.1.9/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/cargo_metadata-0.19.2/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/darling_macro-0.20.11/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/debugid-0.8.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/derive_builder-0.20.2/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/derive_builder_core-0.20.2/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/derive_builder_macro-0.20.2/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/foldhash-0.1.5/LICENSE +0 -19
- data/THIRD_PARTY_LICENSES/from_variant-3.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/funty-2.0.0/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/hashbrown-0.16.1/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/heck-0.5.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/hermit-abi-0.5.2/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/hermit-abi-0.5.2/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/hstr-3.0.3/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/if_chain-1.0.3/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/if_chain-1.0.3/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/is-macro-0.3.7/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/itoa-1.0.17/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/jsonc-parser-0.26.3/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/lazy_static-1.5.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/lazy_static-1.5.0/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/lru-0.16.2/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/memchr-2.7.6/COPYING +0 -3
- data/THIRD_PARTY_LICENSES/memchr-2.7.6/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/miette-derive-7.6.0/LICENSE +0 -229
- data/THIRD_PARTY_LICENSES/normpath-0.2.0/COPYRIGHT +0 -7
- data/THIRD_PARTY_LICENSES/normpath-0.2.0/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/normpath-0.2.0/LICENSE-THIRD-PARTY +0 -210
- data/THIRD_PARTY_LICENSES/num_cpus-1.17.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/num_cpus-1.17.0/LICENSE-MIT +0 -20
- data/THIRD_PARTY_LICENSES/owo-colors-4.2.3/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/par-core-2.0.0/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/par-iter-2.0.0/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/path-clean-0.1.0/LICENSE-APACHE +0 -13
- data/THIRD_PARTY_LICENSES/path-clean-0.1.0/LICENSE-MIT +0 -18
- data/THIRD_PARTY_LICENSES/path-clean-1.0.1/LICENSE-APACHE +0 -13
- data/THIRD_PARTY_LICENSES/path-clean-1.0.1/LICENSE-MIT +0 -18
- data/THIRD_PARTY_LICENSES/pathdiff-0.2.3/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/pathdiff-0.2.3/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/petgraph-0.7.1/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/precomputed-map-0.2.0/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/preset_env_base-6.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/radium-0.7.0/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/radix_fmt-1.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/rand-0.8.5/COPYRIGHT +0 -12
- data/THIRD_PARTY_LICENSES/rand-0.8.5/LICENSE-APACHE +0 -176
- data/THIRD_PARTY_LICENSES/rand_core-0.6.4/COPYRIGHT +0 -12
- data/THIRD_PARTY_LICENSES/rand_core-0.6.4/LICENSE-APACHE +0 -187
- data/THIRD_PARTY_LICENSES/rand_core-0.6.4/LICENSE-MIT +0 -26
- data/THIRD_PARTY_LICENSES/regress-0.10.5/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/regress-0.10.5/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/ryu-1.0.22/LICENSE-APACHE +0 -176
- data/THIRD_PARTY_LICENSES/ryu-1.0.22/LICENSE-BOOST +0 -23
- data/THIRD_PARTY_LICENSES/scoped-tls-1.0.1/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/scoped-tls-1.0.1/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/siphasher-0.3.11/COPYING +0 -7
- data/THIRD_PARTY_LICENSES/smallvec-1.15.1/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/smartstring-1.0.1/LICENCE.md +0 -355
- data/THIRD_PARTY_LICENSES/st-map-0.2.4/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/static-map-macro-0.3.4/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/string_enum-1.0.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/strsim-0.11.1/LICENSE +0 -23
- data/THIRD_PARTY_LICENSES/swc-52.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_allocator-4.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_atoms-9.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_common-18.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_compiler_base-45.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_config-3.1.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_config_macro-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_core-54.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_ast-19.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_codegen-21.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_codegen_macros-2.0.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_bugfixes-39.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_common-30.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2015-39.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2016-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2017-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2018-36.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2019-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2020-37.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2021-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2022-37.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es3-26.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_ext_transforms-25.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_hooks-0.3.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_loader-18.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_minifier-42.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_parser-32.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_preset_env-45.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transformer-6.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms-44.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_base-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_classes-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_compat-40.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_macros-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_module-38.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_optimization-37.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_proposal-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_react-38.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_typescript-38.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_usage_analyzer-27.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_utils-25.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_visit-19.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_eq_ignore_macros-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_error_reporters-20.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_macros_common-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_node_comments-18.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_timer-1.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_trace_macro-2.0.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_transform_common-12.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_visit-2.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/tap-1.0.1/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/tracing-0.1.44/LICENSE +0 -25
- data/THIRD_PARTY_LICENSES/tracing-attributes-0.1.31/LICENSE +0 -25
- data/THIRD_PARTY_LICENSES/tracing-core-0.1.36/LICENSE +0 -25
- data/THIRD_PARTY_LICENSES/triomphe-0.1.15/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/triomphe-0.1.15/LICENSE-MIT +0 -27
- data/THIRD_PARTY_LICENSES/unicode-width-0.1.14/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/unicode-width-0.1.14/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/uuid-1.19.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/uuid-1.19.0/LICENSE-MIT +0 -26
- data/THIRD_PARTY_LICENSES/vergen-9.0.6/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/vergen-9.0.6/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/vergen-lib-0.1.6/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/vergen-lib-0.1.6/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/wyz-0.5.1/LICENSE.txt +0 -21
- data/vendor/cfsolve/src/deobfuscate/analysis/globals.rs +0 -33
- data/vendor/cfsolve/src/deobfuscate/analysis/names.rs +0 -52
- /data/THIRD_PARTY_LICENSES/{derive_builder-0.20.2 → cobs-0.3.0}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{compact_str-0.7.1 → compact_str-0.10.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{ahash-0.8.12 → embedded-io-0.4.0}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{arrayvec-0.7.6 → embedded-io-0.6.1}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{normpath-0.2.0 → escape-simd-0.1.1}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{bstr-1.12.1 → itertools-0.15.0}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{petgraph-0.7.1 → itertools-0.15.0}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{itoa-1.0.17 → itoa-1.0.19}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{camino-1.2.2 → itoa-1.0.19}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{globset-0.4.18 → memchr-2.8.3}/COPYING +0 -0
- /data/THIRD_PARTY_LICENSES/{globset-0.4.18 → memchr-2.8.3}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{camino-1.2.2 → num-bigint-0.5.1}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{swc_sourcemap-9.3.4 → oxc_sourcemap-9.0.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf-0.11.3 → phf-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf_generator-0.11.3 → phf_generator-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf_macros-0.11.3 → phf_macros-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf_shared-0.11.3 → phf_shared-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{fixedbitset-0.5.7 → postcard-1.1.3}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{hashbrown-0.14.5 → smallvec-1.16.5}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{smallvec-1.15.1 → smallvec-1.16.5}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{unicode-width-0.1.14 → unicode-segmentation-1.13.3}/COPYRIGHT +0 -0
- /data/THIRD_PARTY_LICENSES/{hashbrown-0.16.1 → unicode-segmentation-1.13.3}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{heck-0.5.0 → unicode-segmentation-1.13.3}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{cargo-platform-0.1.9 → zmij_ecma-1.0.23}/LICENSE-MIT +0 -0
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
use std::{mem, ptr};
|
|
4
4
|
|
|
5
|
-
use
|
|
5
|
+
use oxc::ast::ast::Function;
|
|
6
6
|
|
|
7
7
|
use super::copies::Copies;
|
|
8
8
|
use super::intrinsic;
|
|
9
|
+
use super::plan::Routine;
|
|
9
10
|
use super::run::{Decrypted, Run, Snapshot, Stop};
|
|
10
11
|
use crate::vm::dispatch::Decoded;
|
|
11
12
|
use crate::vm::output::Path;
|
|
@@ -24,7 +25,7 @@ pub(crate) struct Invocation<'session, 'ast> {
|
|
|
24
25
|
pub pc: u32,
|
|
25
26
|
/// The dispatch key the opcode byte leaves.
|
|
26
27
|
pub key: u8,
|
|
27
|
-
pub handler: &'ast Function
|
|
28
|
+
pub handler: &'ast Function<'ast>,
|
|
28
29
|
/// The instance fields the constructor derives from the program.
|
|
29
30
|
pub fields: &'session HashMap<String, Value<'ast>>,
|
|
30
31
|
/// Strings decrypted from the program so far.
|
|
@@ -65,7 +66,8 @@ pub(crate) fn explore<'ast>(invocation: &Invocation<'_, 'ast>) -> Option<Ways<'a
|
|
|
65
66
|
let plan = if special {
|
|
66
67
|
None
|
|
67
68
|
} else {
|
|
68
|
-
|
|
69
|
+
Routine::function(handler)
|
|
70
|
+
.and_then(|routine| session.compiled.slots(session.script, routine))
|
|
69
71
|
};
|
|
70
72
|
// A run that thaws a shared session object leaves no results; explore again with the
|
|
71
73
|
// object copied.
|
|
@@ -196,22 +198,17 @@ pub(crate) struct Branching {
|
|
|
196
198
|
pub(crate) fn decode<'ast>(
|
|
197
199
|
session: &Session<'ast>,
|
|
198
200
|
program: &[u8],
|
|
199
|
-
decoder:
|
|
201
|
+
decoder: Routine<'ast>,
|
|
200
202
|
arguments: Vec<Value<'ast>>,
|
|
201
203
|
pc: u32,
|
|
202
204
|
key: u8,
|
|
203
205
|
) -> Result<Decoded, String> {
|
|
204
|
-
let decoder = Callable::Script {
|
|
205
|
-
name: None,
|
|
206
|
-
function: decoder,
|
|
207
|
-
scope: None,
|
|
208
|
-
};
|
|
209
206
|
// A run that thaws a shared session object decodes again with the object copied.
|
|
210
207
|
let (outcome, next) = loop {
|
|
211
208
|
let mut run = Run::new(session, program, Vec::new(), Some(Copies::default()));
|
|
212
209
|
run.sharing = true;
|
|
213
210
|
run.start_at(pc, key);
|
|
214
|
-
let outcome = run.
|
|
211
|
+
let outcome = run.routine(decoder, None, Value::Undefined, arguments.clone());
|
|
215
212
|
let next = run.register_value(session.layout.key);
|
|
216
213
|
for scope in run.scopes() {
|
|
217
214
|
scope.borrow_mut().variables.clear();
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
//! Integer formulas captured from scripts, evaluated with JavaScript's number semantics.
|
|
2
|
+
//!
|
|
3
|
+
//! The obfuscator varies the arithmetic of some helpers per build. A [`super::pattern`]
|
|
4
|
+
//! template captures such arithmetic as a formula over named inputs instead of fixing it.
|
|
5
|
+
|
|
6
|
+
use oxc::ast::ast::{Expression, IdentifierReference};
|
|
7
|
+
use oxc::syntax::operator::BinaryOperator;
|
|
8
|
+
|
|
9
|
+
use crate::js;
|
|
10
|
+
use crate::vm::convert;
|
|
11
|
+
use crate::vm::value::Value;
|
|
12
|
+
|
|
13
|
+
/// An expression of numeric literals, named inputs, indexed inputs, and arithmetic or bitwise
|
|
14
|
+
/// operators.
|
|
15
|
+
#[derive(Clone)]
|
|
16
|
+
pub(super) enum Formula {
|
|
17
|
+
Number(f64),
|
|
18
|
+
Input(String),
|
|
19
|
+
Index {
|
|
20
|
+
input: String,
|
|
21
|
+
index: Box<Formula>,
|
|
22
|
+
},
|
|
23
|
+
Binary {
|
|
24
|
+
operator: BinaryOperator,
|
|
25
|
+
left: Box<Formula>,
|
|
26
|
+
right: Box<Formula>,
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/// A formula input's value.
|
|
31
|
+
pub(super) enum Input<'a, 'ast> {
|
|
32
|
+
Number(f64),
|
|
33
|
+
Array(&'a [Value<'ast>]),
|
|
34
|
+
Bytes(&'a [u8]),
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
impl Formula {
|
|
38
|
+
/// Compiles `expression`, with each subexpression in the form `normal` gives it, naming each
|
|
39
|
+
/// identifier with `name`. Returns `None` for anything outside the supported forms.
|
|
40
|
+
pub(super) fn compile<'e>(
|
|
41
|
+
expression: &'e Expression<'e>,
|
|
42
|
+
normal: &impl Fn(&'e Expression<'e>) -> &'e Expression<'e>,
|
|
43
|
+
name: &impl Fn(&IdentifierReference<'_>) -> Option<String>,
|
|
44
|
+
) -> Option<Self> {
|
|
45
|
+
let compile = |expression| Self::compile(expression, normal, name);
|
|
46
|
+
Some(match normal(expression).without_parentheses() {
|
|
47
|
+
Expression::NumericLiteral(number) => Self::Number(number.value),
|
|
48
|
+
Expression::Identifier(identifier) => Self::Input(name(identifier)?),
|
|
49
|
+
Expression::ComputedMemberExpression(member) => {
|
|
50
|
+
let Expression::Identifier(input) = normal(&member.object) else {
|
|
51
|
+
return None;
|
|
52
|
+
};
|
|
53
|
+
Self::Index {
|
|
54
|
+
input: name(input)?,
|
|
55
|
+
index: Box::new(compile(&member.expression)?),
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
Expression::BinaryExpression(binary)
|
|
59
|
+
if matches!(
|
|
60
|
+
binary.operator,
|
|
61
|
+
BinaryOperator::BitwiseAnd
|
|
62
|
+
| BinaryOperator::BitwiseOR
|
|
63
|
+
| BinaryOperator::BitwiseXOR
|
|
64
|
+
| BinaryOperator::Addition
|
|
65
|
+
| BinaryOperator::Subtraction
|
|
66
|
+
| BinaryOperator::Multiplication
|
|
67
|
+
| BinaryOperator::ShiftLeft
|
|
68
|
+
| BinaryOperator::ShiftRight
|
|
69
|
+
| BinaryOperator::ShiftRightZeroFill
|
|
70
|
+
) =>
|
|
71
|
+
{
|
|
72
|
+
Self::Binary {
|
|
73
|
+
operator: binary.operator,
|
|
74
|
+
left: Box::new(compile(&binary.left)?),
|
|
75
|
+
right: Box::new(compile(&binary.right)?),
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
_ => return None,
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/// Evaluates the formula as the script would, given every input's value by name. Returns
|
|
83
|
+
/// `None` where the script would see a non-number, such as an index out of range.
|
|
84
|
+
pub(super) fn evaluate(&self, inputs: &[(&str, Input<'_, '_>)]) -> Option<f64> {
|
|
85
|
+
let input = |name: &str| {
|
|
86
|
+
let (_, input) = inputs.iter().find(|(found, _)| *found == name)?;
|
|
87
|
+
Some(input)
|
|
88
|
+
};
|
|
89
|
+
Some(match self {
|
|
90
|
+
Self::Number(number) => *number,
|
|
91
|
+
Self::Input(name) => match input(name)? {
|
|
92
|
+
Input::Number(number) => *number,
|
|
93
|
+
Input::Array(_) | Input::Bytes(_) => return None,
|
|
94
|
+
},
|
|
95
|
+
Self::Index { input: name, index } => {
|
|
96
|
+
let index = convert::index(index.evaluate(inputs)?)?;
|
|
97
|
+
match input(name)? {
|
|
98
|
+
Input::Array(elements) => match elements.get(index)? {
|
|
99
|
+
Value::Number(number) => *number,
|
|
100
|
+
_ => return None,
|
|
101
|
+
},
|
|
102
|
+
Input::Bytes(bytes) => f64::from(*bytes.get(index)?),
|
|
103
|
+
Input::Number(_) => return None,
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
Self::Binary {
|
|
107
|
+
operator,
|
|
108
|
+
left,
|
|
109
|
+
right,
|
|
110
|
+
} => {
|
|
111
|
+
// Operands are numbers, so each operator is its numeric case.
|
|
112
|
+
let (left, right) = (left.evaluate(inputs)?, right.evaluate(inputs)?);
|
|
113
|
+
let shift = || js::int32(right) as u32 & 31;
|
|
114
|
+
match operator {
|
|
115
|
+
BinaryOperator::BitwiseAnd => f64::from(js::int32(left) & js::int32(right)),
|
|
116
|
+
BinaryOperator::BitwiseOR => f64::from(js::int32(left) | js::int32(right)),
|
|
117
|
+
BinaryOperator::BitwiseXOR => f64::from(js::int32(left) ^ js::int32(right)),
|
|
118
|
+
BinaryOperator::Addition => left + right,
|
|
119
|
+
BinaryOperator::Subtraction => left - right,
|
|
120
|
+
BinaryOperator::Multiplication => left * right,
|
|
121
|
+
BinaryOperator::ShiftLeft => f64::from(js::int32(left).wrapping_shl(shift())),
|
|
122
|
+
BinaryOperator::ShiftRight => f64::from(js::int32(left) >> shift()),
|
|
123
|
+
BinaryOperator::ShiftRightZeroFill => {
|
|
124
|
+
f64::from(js::int32(left) as u32 >> shift())
|
|
125
|
+
}
|
|
126
|
+
_ => unreachable!("compile admits only these operators"),
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -13,11 +13,9 @@
|
|
|
13
13
|
use std::cell::RefCell;
|
|
14
14
|
use std::rc::Rc;
|
|
15
15
|
|
|
16
|
-
use
|
|
17
|
-
use swc_core::atoms::Atom;
|
|
18
|
-
|
|
19
|
-
use crate::vm::HashMap;
|
|
16
|
+
use crate::js::ast::Binding;
|
|
20
17
|
use crate::vm::value::Value;
|
|
18
|
+
use crate::vm::{HashMap, HashSet};
|
|
21
19
|
|
|
22
20
|
#[derive(Default)]
|
|
23
21
|
pub(crate) struct Frozen {
|
|
@@ -32,7 +30,7 @@ pub(crate) struct Frozen {
|
|
|
32
30
|
impl Frozen {
|
|
33
31
|
/// Groups the objects reachable from `bindings` and shares those of groups that reach no
|
|
34
32
|
/// function with captured state.
|
|
35
|
-
pub(crate) fn of(bindings: &HashMap<
|
|
33
|
+
pub(crate) fn of(bindings: &HashMap<Binding<'_>, Value<'_>>) -> Self {
|
|
36
34
|
let mut groups = Groups::default();
|
|
37
35
|
for value in bindings.values() {
|
|
38
36
|
let mut reached = Reached::default();
|
|
@@ -1,23 +1,28 @@
|
|
|
1
|
-
//! Native versions of
|
|
2
|
-
//!
|
|
3
|
-
//!
|
|
4
|
-
//! interpreted.
|
|
1
|
+
//! Native versions of script functions. Register bookkeeping is recognized structurally;
|
|
2
|
+
//! BLAKE3 compression must also agree on test inputs. Calls outside each native version's
|
|
3
|
+
//! supported arguments are interpreted.
|
|
5
4
|
|
|
6
5
|
use std::ptr;
|
|
7
6
|
|
|
8
|
-
use
|
|
9
|
-
use
|
|
7
|
+
use oxc::ast::ast::{Function, NumericLiteral, ObjectProperty};
|
|
8
|
+
use oxc::ast_visit::{Visit, walk};
|
|
9
|
+
use oxc::semantic::ScopeFlags;
|
|
10
10
|
|
|
11
11
|
use super::copies::Copies;
|
|
12
|
+
use super::mix32::Mix32;
|
|
13
|
+
use super::register_helpers::{self, Helper};
|
|
12
14
|
use super::run::Run;
|
|
13
15
|
use crate::js;
|
|
14
|
-
use crate::vm::HashMap;
|
|
15
16
|
use crate::vm::session::Session;
|
|
16
17
|
use crate::vm::value::{Callable, Value};
|
|
18
|
+
use crate::vm::{HashMap, extract};
|
|
17
19
|
|
|
18
20
|
/// A native function equivalent to a script function.
|
|
19
21
|
#[derive(Clone, Copy)]
|
|
20
22
|
pub(crate) enum Intrinsic {
|
|
23
|
+
/// Bookkeeping on the interpreter's unmasked register file.
|
|
24
|
+
Register(Helper),
|
|
25
|
+
Mix32(Mix32),
|
|
21
26
|
/// `compress(cv, block, counter, length, flags)`: overwrites the 8 words of `cv` with the
|
|
22
27
|
/// BLAKE3 compression of the 16-word `block`.
|
|
23
28
|
Blake3Compress,
|
|
@@ -27,59 +32,109 @@ pub(crate) enum Intrinsic {
|
|
|
27
32
|
pub(crate) type Intrinsics = HashMap<usize, Intrinsic>;
|
|
28
33
|
|
|
29
34
|
/// The address identifying `function` in [`Intrinsics`].
|
|
30
|
-
pub(super) fn address(function: &Function) -> usize {
|
|
35
|
+
pub(super) fn address(function: &Function<'_>) -> usize {
|
|
31
36
|
ptr::from_ref(function).addr()
|
|
32
37
|
}
|
|
33
38
|
|
|
34
|
-
/// Finds
|
|
35
|
-
///
|
|
39
|
+
/// Finds register helpers and mixers, and validates BLAKE3 candidates taking five parameters
|
|
40
|
+
/// and mentioning its initialization vector's first word, which some builds store complemented.
|
|
36
41
|
pub(crate) fn intrinsics(session: &Session<'_>) -> Intrinsics {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
let mut intrinsics = Intrinsics::default();
|
|
43
|
+
let script = session.script;
|
|
44
|
+
for function in session.functions.values() {
|
|
45
|
+
let intrinsic = if let Some(helper) = register_helpers::recognize(script, function) {
|
|
46
|
+
Intrinsic::Register(helper)
|
|
47
|
+
} else if let Some(mixer) = Mix32::recognize(script, function) {
|
|
48
|
+
Intrinsic::Mix32(mixer)
|
|
49
|
+
} else if extract::parameter_count(&function.params) == 5
|
|
50
|
+
// `~IV[0]` is written as the negation of `IV[0] + 1`.
|
|
51
|
+
&& (mentions(function, f64::from(IV[0]))
|
|
52
|
+
|| mentions(function, f64::from(IV[0]) + 1.0))
|
|
53
|
+
&& compresses_like_native(session, function)
|
|
54
|
+
{
|
|
55
|
+
Intrinsic::Blake3Compress
|
|
56
|
+
} else {
|
|
57
|
+
continue;
|
|
58
|
+
};
|
|
59
|
+
intrinsics.insert(address(function), intrinsic);
|
|
60
|
+
}
|
|
61
|
+
intrinsics
|
|
44
62
|
}
|
|
45
63
|
|
|
46
64
|
impl Intrinsic {
|
|
47
|
-
/// Runs
|
|
65
|
+
/// Runs a register helper or mixer natively. Returns `None` for BLAKE3 compression, which
|
|
66
|
+
/// [`blake3_compress`] runs, and for arguments outside what the native version reproduces
|
|
48
67
|
/// exactly, leaving the call to the interpreter.
|
|
49
|
-
pub(super) fn call<'ast>(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
flags,
|
|
58
|
-
] = arguments
|
|
59
|
-
else {
|
|
68
|
+
pub(super) fn call<'ast>(
|
|
69
|
+
self,
|
|
70
|
+
run: &mut Run<'ast, '_>,
|
|
71
|
+
arguments: &[Value<'ast>],
|
|
72
|
+
) -> Option<Value<'ast>> {
|
|
73
|
+
let register = match self {
|
|
74
|
+
Self::Mix32(mixer) => {
|
|
75
|
+
let Some(Value::Number(number)) = arguments.first() else {
|
|
60
76
|
return None;
|
|
61
77
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
js::int32(flags.as_number()?) as u32,
|
|
70
|
-
)
|
|
71
|
-
};
|
|
72
|
-
let mut cv = cv.borrow_mut();
|
|
73
|
-
for (slot, word) in cv.iter_mut().zip(output) {
|
|
74
|
-
// The script stores the results of `^`, which are signed.
|
|
75
|
-
*slot = Value::Number(f64::from(word as i32));
|
|
76
|
-
}
|
|
77
|
-
Some(Value::Undefined)
|
|
78
|
+
return Some(Value::Number(mixer.call(*number)));
|
|
79
|
+
}
|
|
80
|
+
Self::Register(Helper::Number) => {
|
|
81
|
+
return arguments
|
|
82
|
+
.first()
|
|
83
|
+
.filter(|value| matches!(value, Value::Number(_)))
|
|
84
|
+
.cloned();
|
|
78
85
|
}
|
|
86
|
+
Self::Register(Helper::Mask) => {
|
|
87
|
+
return matches!(arguments.first(), Some(Value::Registers))
|
|
88
|
+
.then_some(Value::Undefined);
|
|
89
|
+
}
|
|
90
|
+
Self::Register(Helper::Pc) => run.session.layout.pc,
|
|
91
|
+
Self::Register(Helper::Key) => run.session.layout.key,
|
|
92
|
+
Self::Blake3Compress => return None,
|
|
93
|
+
};
|
|
94
|
+
let [Value::Registers, value @ Value::Number(number), ..] = arguments else {
|
|
95
|
+
return None;
|
|
96
|
+
};
|
|
97
|
+
// Both setter branches store exactly this value for signed integers other than -0.
|
|
98
|
+
if *number != f64::from(js::int32(*number)) || (*number == 0.0 && number.is_sign_negative())
|
|
99
|
+
{
|
|
100
|
+
return None;
|
|
79
101
|
}
|
|
102
|
+
run.set_register(register, value.clone());
|
|
103
|
+
Some(value.clone())
|
|
80
104
|
}
|
|
81
105
|
}
|
|
82
106
|
|
|
107
|
+
/// Runs [`Intrinsic::Blake3Compress`]. Returns `None` if the arguments are outside what it
|
|
108
|
+
/// reproduces exactly, leaving the call to the interpreter.
|
|
109
|
+
pub(super) fn blake3_compress<'ast>(arguments: &[Value<'ast>]) -> Option<Value<'ast>> {
|
|
110
|
+
let [
|
|
111
|
+
Value::Array(cv),
|
|
112
|
+
Value::Array(block),
|
|
113
|
+
counter,
|
|
114
|
+
length,
|
|
115
|
+
flags,
|
|
116
|
+
] = arguments
|
|
117
|
+
else {
|
|
118
|
+
return None;
|
|
119
|
+
};
|
|
120
|
+
let output = {
|
|
121
|
+
let (cv, block) = (cv.borrow(), block.borrow());
|
|
122
|
+
compress(
|
|
123
|
+
&words(cv.get(..8)?)?,
|
|
124
|
+
&words(block.get(..16)?)?,
|
|
125
|
+
Counter::of(counter.as_number()?),
|
|
126
|
+
js::int32(length.as_number()?) as u32,
|
|
127
|
+
js::int32(flags.as_number()?) as u32,
|
|
128
|
+
)
|
|
129
|
+
};
|
|
130
|
+
let mut cv = cv.borrow_mut();
|
|
131
|
+
for (slot, word) in cv.iter_mut().zip(output) {
|
|
132
|
+
// The script stores the results of `^`, which are signed.
|
|
133
|
+
*slot = Value::Number(f64::from(word as i32));
|
|
134
|
+
}
|
|
135
|
+
Some(Value::Undefined)
|
|
136
|
+
}
|
|
137
|
+
|
|
83
138
|
impl Value<'_> {
|
|
84
139
|
fn as_number(&self) -> Option<f64> {
|
|
85
140
|
match self {
|
|
@@ -92,7 +147,7 @@ impl Value<'_> {
|
|
|
92
147
|
/// Converts state or message words. The script first adds three words before truncating, which
|
|
93
148
|
/// matches wrapping addition only while the sum is exact, so larger or fractional words are
|
|
94
149
|
/// rejected.
|
|
95
|
-
fn words<const N: usize>(values: &[Value<'_>]) -> Option<[u32; N]> {
|
|
150
|
+
pub(super) fn words<const N: usize>(values: &[Value<'_>]) -> Option<[u32; N]> {
|
|
96
151
|
let mut words = [0; N];
|
|
97
152
|
for (word, value) in words.iter_mut().zip(values) {
|
|
98
153
|
let number = value.as_number()?;
|
|
@@ -107,13 +162,13 @@ fn words<const N: usize>(values: &[Value<'_>]) -> Option<[u32; N]> {
|
|
|
107
162
|
/// A block counter split as the script splits it: `counter | 0` and
|
|
108
163
|
/// `counter / 4294967296 | 0`.
|
|
109
164
|
#[derive(Clone, Copy)]
|
|
110
|
-
struct Counter {
|
|
165
|
+
pub(super) struct Counter {
|
|
111
166
|
low: u32,
|
|
112
167
|
high: u32,
|
|
113
168
|
}
|
|
114
169
|
|
|
115
170
|
impl Counter {
|
|
116
|
-
fn of(counter: f64) -> Self {
|
|
171
|
+
pub(super) fn of(counter: f64) -> Self {
|
|
117
172
|
Self {
|
|
118
173
|
low: js::int32(counter) as u32,
|
|
119
174
|
high: js::int32(counter / 4_294_967_296.0) as u32,
|
|
@@ -136,7 +191,7 @@ const IV: [u32; 8] = [
|
|
|
136
191
|
const PERMUTATION: [usize; 16] = [2, 6, 3, 10, 7, 0, 4, 13, 1, 11, 12, 5, 9, 14, 15, 8];
|
|
137
192
|
|
|
138
193
|
/// The BLAKE3 compression function, truncated to the chaining value.
|
|
139
|
-
fn compress(
|
|
194
|
+
pub(super) fn compress(
|
|
140
195
|
cv: &[u32; 8],
|
|
141
196
|
block: &[u32; 16],
|
|
142
197
|
counter: Counter,
|
|
@@ -177,32 +232,41 @@ fn mix(state: &mut [u32; 16], [a, b, c, d]: [usize; 4], x: u32, y: u32) {
|
|
|
177
232
|
}
|
|
178
233
|
|
|
179
234
|
/// Whether `function` contains the numeric literal `number`.
|
|
180
|
-
fn mentions(function: &Function
|
|
235
|
+
fn mentions(function: &Function<'_>, number: f64) -> bool {
|
|
181
236
|
struct Finder {
|
|
182
237
|
number: f64,
|
|
183
238
|
found: bool,
|
|
184
239
|
}
|
|
185
240
|
|
|
186
|
-
impl Visit for Finder {
|
|
187
|
-
fn
|
|
188
|
-
self.found |=
|
|
241
|
+
impl<'a> Visit<'a> for Finder {
|
|
242
|
+
fn visit_numeric_literal(&mut self, literal: &NumericLiteral<'a>) {
|
|
243
|
+
self.found |= literal.value == self.number;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/// A numeric key names a property; only computed keys hold values.
|
|
247
|
+
fn visit_object_property(&mut self, property: &ObjectProperty<'a>) {
|
|
248
|
+
if property.computed {
|
|
249
|
+
walk::walk_object_property(self, property);
|
|
250
|
+
} else {
|
|
251
|
+
self.visit_expression(&property.value);
|
|
252
|
+
}
|
|
189
253
|
}
|
|
190
254
|
}
|
|
191
255
|
|
|
192
256
|
let mut finder = Finder {
|
|
193
|
-
number
|
|
257
|
+
number,
|
|
194
258
|
found: false,
|
|
195
259
|
};
|
|
196
|
-
|
|
260
|
+
finder.visit_function(function, ScopeFlags::Function);
|
|
197
261
|
finder.found
|
|
198
262
|
}
|
|
199
263
|
|
|
200
|
-
/// Whether interpreting `function` gives the result of [`
|
|
264
|
+
/// Whether interpreting `function` gives the result of [`blake3_compress`] on every
|
|
201
265
|
/// test input, returning nothing and recording no effects.
|
|
202
|
-
fn compresses_like_native<'ast>(session: &Session<'ast>, function: &'ast Function) -> bool {
|
|
266
|
+
fn compresses_like_native<'ast>(session: &Session<'ast>, function: &'ast Function<'ast>) -> bool {
|
|
203
267
|
TEST_INPUTS.iter().all(|input| {
|
|
204
268
|
let native = input.arguments();
|
|
205
|
-
if
|
|
269
|
+
if blake3_compress(&native).is_none() {
|
|
206
270
|
return false;
|
|
207
271
|
}
|
|
208
272
|
// Clones share the arrays, so `interpreted` shows what the script wrote.
|
|
@@ -345,6 +409,6 @@ mod tests {
|
|
|
345
409
|
fn rejects_inexact_words() {
|
|
346
410
|
let mut arguments = TEST_INPUTS[0].arguments();
|
|
347
411
|
arguments[1] = Value::array(vec![Value::Number(0.5); 16]);
|
|
348
|
-
assert!(
|
|
412
|
+
assert!(blake3_compress(&arguments).is_none());
|
|
349
413
|
}
|
|
350
414
|
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
//! The straight-line integer mixer used for instruction positions and string offsets. Match
|
|
2
|
+
//! every operation and recover its constants; leave all other functions to the interpreter.
|
|
3
|
+
|
|
4
|
+
use oxc::ast::ast::{
|
|
5
|
+
AssignmentExpression, AssignmentOperator, AssignmentTarget, BinaryExpression, Expression,
|
|
6
|
+
Function, Statement,
|
|
7
|
+
};
|
|
8
|
+
use oxc::semantic::SymbolId;
|
|
9
|
+
use oxc::syntax::operator::BinaryOperator;
|
|
10
|
+
|
|
11
|
+
use crate::js;
|
|
12
|
+
use crate::js::ast::{self, Script};
|
|
13
|
+
use crate::vm::extract;
|
|
14
|
+
|
|
15
|
+
#[derive(Clone, Copy)]
|
|
16
|
+
pub(crate) struct Mix32 {
|
|
17
|
+
seed: i32,
|
|
18
|
+
rounds: [Round; 2],
|
|
19
|
+
final_shift: u32,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/// `x = (x ^ x >>> shift) * multiplier | 0`.
|
|
23
|
+
#[derive(Clone, Copy)]
|
|
24
|
+
struct Round {
|
|
25
|
+
shift: u32,
|
|
26
|
+
multiplier: f64,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
impl Mix32 {
|
|
30
|
+
pub(super) fn recognize(script: Script<'_>, function: &Function<'_>) -> Option<Self> {
|
|
31
|
+
if function.r#async || function.generator {
|
|
32
|
+
return None;
|
|
33
|
+
}
|
|
34
|
+
let [parameter] = extract::parameters(&function.params)?[..] else {
|
|
35
|
+
return None;
|
|
36
|
+
};
|
|
37
|
+
let parameter = parameter.symbol_id();
|
|
38
|
+
let body = function.body.as_deref()?;
|
|
39
|
+
if !body.directives.is_empty() {
|
|
40
|
+
return None;
|
|
41
|
+
}
|
|
42
|
+
// Statements after the `return` never run, unless they declare something.
|
|
43
|
+
let statements = &body.statements;
|
|
44
|
+
let end = statements
|
|
45
|
+
.iter()
|
|
46
|
+
.position(|statement| matches!(statement, Statement::ReturnStatement(_)))?
|
|
47
|
+
+ 1;
|
|
48
|
+
if statements[end..].iter().any(Statement::is_declaration) {
|
|
49
|
+
return None;
|
|
50
|
+
}
|
|
51
|
+
let [seed, first, second, returned] = &statements[..end] else {
|
|
52
|
+
return None;
|
|
53
|
+
};
|
|
54
|
+
let Statement::ReturnStatement(returned) = returned else {
|
|
55
|
+
return None;
|
|
56
|
+
};
|
|
57
|
+
let seed = assignment(seed)?;
|
|
58
|
+
if !is_target(script, &seed.left, parameter)
|
|
59
|
+
|| seed.operator != AssignmentOperator::BitwiseXOR
|
|
60
|
+
{
|
|
61
|
+
return None;
|
|
62
|
+
}
|
|
63
|
+
Some(Self {
|
|
64
|
+
seed: js::int32(number(&seed.right)?),
|
|
65
|
+
rounds: [
|
|
66
|
+
round(script, parameter, first)?,
|
|
67
|
+
round(script, parameter, second)?,
|
|
68
|
+
],
|
|
69
|
+
final_shift: mixed(script, parameter, returned.argument.as_ref()?)?,
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
pub(super) fn call(self, number: f64) -> f64 {
|
|
74
|
+
let mut value = js::int32(number) ^ self.seed;
|
|
75
|
+
for Round { shift, multiplier } in self.rounds {
|
|
76
|
+
let mixed = value ^ ((value as u32) >> shift) as i32;
|
|
77
|
+
value = js::int32(f64::from(mixed) * multiplier);
|
|
78
|
+
}
|
|
79
|
+
f64::from(value ^ ((value as u32) >> self.final_shift) as i32)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
fn number(expression: &Expression<'_>) -> Option<f64> {
|
|
84
|
+
ast::fold_number(expression, &|_| None)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/// Whether `expression`, inside any parentheses, is a reference to `symbol`.
|
|
88
|
+
pub(super) fn is_symbol(script: Script<'_>, expression: &Expression<'_>, symbol: SymbolId) -> bool {
|
|
89
|
+
script.refers_to(expression.without_parentheses(), symbol)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/// Whether an assignment target is the identifier of `symbol`.
|
|
93
|
+
fn is_target(script: Script<'_>, target: &AssignmentTarget<'_>, symbol: SymbolId) -> bool {
|
|
94
|
+
matches!(target, AssignmentTarget::AssignmentTargetIdentifier(name)
|
|
95
|
+
if script.symbol(name) == Some(symbol))
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/// The assignment an expression statement makes.
|
|
99
|
+
pub(super) fn assignment<'s, 'a>(
|
|
100
|
+
statement: &'s Statement<'a>,
|
|
101
|
+
) -> Option<&'s AssignmentExpression<'a>> {
|
|
102
|
+
match statement {
|
|
103
|
+
Statement::ExpressionStatement(statement) => match &statement.expression {
|
|
104
|
+
Expression::AssignmentExpression(assignment) => Some(assignment),
|
|
105
|
+
_ => None,
|
|
106
|
+
},
|
|
107
|
+
_ => None,
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/// The binary expression inside any parentheses.
|
|
112
|
+
pub(super) fn binary<'s, 'a>(expression: &'s Expression<'a>) -> Option<&'s BinaryExpression<'a>> {
|
|
113
|
+
match expression.without_parentheses() {
|
|
114
|
+
Expression::BinaryExpression(binary) => Some(binary),
|
|
115
|
+
_ => None,
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/// The shift of `x ^ x >>> shift`, where `x` is the `parameter`.
|
|
120
|
+
fn mixed(script: Script<'_>, parameter: SymbolId, expression: &Expression<'_>) -> Option<u32> {
|
|
121
|
+
let is_parameter = |expression: &Expression<'_>| is_symbol(script, expression, parameter);
|
|
122
|
+
let xor = binary(expression)?;
|
|
123
|
+
if xor.operator != BinaryOperator::BitwiseXOR {
|
|
124
|
+
return None;
|
|
125
|
+
}
|
|
126
|
+
let shifted = if is_parameter(&xor.left) {
|
|
127
|
+
&xor.right
|
|
128
|
+
} else if is_parameter(&xor.right) {
|
|
129
|
+
&xor.left
|
|
130
|
+
} else {
|
|
131
|
+
return None;
|
|
132
|
+
};
|
|
133
|
+
let shifted = binary(shifted)?;
|
|
134
|
+
if shifted.operator != BinaryOperator::ShiftRightZeroFill || !is_parameter(&shifted.left) {
|
|
135
|
+
return None;
|
|
136
|
+
}
|
|
137
|
+
Some(js::int32(number(&shifted.right)?) as u32 & 31)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
fn round(script: Script<'_>, parameter: SymbolId, statement: &Statement<'_>) -> Option<Round> {
|
|
141
|
+
let assignment = assignment(statement)?;
|
|
142
|
+
if assignment.operator != AssignmentOperator::Assign
|
|
143
|
+
|| !is_target(script, &assignment.left, parameter)
|
|
144
|
+
{
|
|
145
|
+
return None;
|
|
146
|
+
}
|
|
147
|
+
let truncated = binary(&assignment.right)?;
|
|
148
|
+
if truncated.operator != BinaryOperator::BitwiseOR {
|
|
149
|
+
return None;
|
|
150
|
+
}
|
|
151
|
+
let product = if number(&truncated.left) == Some(0.0) {
|
|
152
|
+
&truncated.right
|
|
153
|
+
} else if number(&truncated.right) == Some(0.0) {
|
|
154
|
+
&truncated.left
|
|
155
|
+
} else {
|
|
156
|
+
return None;
|
|
157
|
+
};
|
|
158
|
+
let product = binary(product)?;
|
|
159
|
+
if product.operator != BinaryOperator::Multiplication {
|
|
160
|
+
return None;
|
|
161
|
+
}
|
|
162
|
+
let (shift, multiplier) = match number(&product.left) {
|
|
163
|
+
Some(multiplier) => (mixed(script, parameter, &product.right)?, multiplier),
|
|
164
|
+
None => (
|
|
165
|
+
mixed(script, parameter, &product.left)?,
|
|
166
|
+
number(&product.right)?,
|
|
167
|
+
),
|
|
168
|
+
};
|
|
169
|
+
Some(Round { shift, multiplier })
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
#[cfg(test)]
|
|
173
|
+
mod tests {
|
|
174
|
+
use super::*;
|
|
175
|
+
use crate::vm::interpret::register_helpers::tests::assert_native_matches_interpreted;
|
|
176
|
+
|
|
177
|
+
#[test]
|
|
178
|
+
fn native_mixers_match_their_scripts() {
|
|
179
|
+
for source in [
|
|
180
|
+
"function f(x) { x ^= 1265281276; x = (x ^ x >>> 16) * 40503 | 0; x = 13849 * (x ^ x >>> 13) | 0; return x >>> 16 ^ x; }",
|
|
181
|
+
"function f(renamed) { renamed ^= -123; renamed = 0 | 7 * (renamed >>> 3 ^ renamed); renamed = ((renamed ^ renamed >>> 0) * 11) | 0; return renamed ^ renamed >>> 31; }",
|
|
182
|
+
"function f(x) { x ^= 1265281276; x = (x >>> 16 ^ x) * 40503 | 0; x = 0 | 13849 * (x ^ x >>> 13); return x ^ x >>> 16; return; }",
|
|
183
|
+
] {
|
|
184
|
+
assert_native_matches_interpreted(source, |script, function| {
|
|
185
|
+
Mix32::recognize(script, function).is_some()
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|