占用空间少的 WebAssembly 语言 [英] WebAssembly language with small footprint

查看:31
本文介绍了占用空间少的 WebAssembly 语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种编译为 wasm(或其他非人类可读并通过 Web 程序集运行的其他语言,如 dll)的语言,占用空间小.我需要能够通过 javascript 与它进行交互.

I'm looking for a language that is compiled to wasm (or to something else that's not human-readable and run through web assembly, like a dll), with a small footprint. I need to be able to interact with it from javascript.

我需要它以用户无法轻松弄清楚的方式执行字符串散列.我知道在客户端上运行的任何东西都不安全,但这是一种威慑,而不是安全功能(如验证码).

What I need it for is to perform hashing of a string in a way a user wouldn't be able to easily figure out. I know anything that runs on the client is not secure, but it's a deterrent, not a security feature (like a captcha).

我已经使用 Blazor 完成了此操作,但下载大小太大,因此我正在寻找占用空间更小的东西.

I have already done this with Blazor, but the download size is too large, so I'm looking for something that has a smaller footprint.

谢谢!

推荐答案

一种针对 WebAssebmly 的轻量级方法是 https://github.com/AssemblyScript/assemblyscript.这是低级别的,但更容易编写原始 WebAssembly.如果您小心避免依赖于 libc 的较大部分,那么 emscripten 也可以生成非常小的二进制文件.

One lightweight way to target WebAssebmly is https://github.com/AssemblyScript/assemblyscript. It's low level but more easy to write that raw WebAssembly. if you are careful to avoid dependencies on the larger parts of libc, then emscripten can also produce very small binary files.

然而,如果你的目标是混淆,那么 WebAssebmly 真的不比 JavaScript 好.WebAssembly 不是为此目的而设计的.与 JVM 字节码之类的东西一样,有一些工具可以很好地反编译 WebAssembly 二进制文件.请参阅 wasm-deompile,它是 https://github.com/WebAssembly/wabt 的一部分.这些工具只会随着时间的推移变得更好.

However, if your goal is obfuscation then WebAssebmly is really not better than JavaScript. WebAssembly was not designed for this purpose. As with something like the JVM bytecode there are tools out there are do good job of decompiling WebAssembly binaries. See wasm-deompile which is part of https://github.com/WebAssembly/wabt. These tools will only get better over time.

这篇关于占用空间少的 WebAssembly 语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆