18 lines
399 B
Python
18 lines
399 B
Python
# -*- encoding:utf-8 -*-
|
|
|
|
'''
|
|
@Author : dingjiawen
|
|
@Date : 2024/03/26 12:54
|
|
@Usage :
|
|
@Desc :使用pywasm执行wasm文件
|
|
'''
|
|
|
|
from wasmer import engine, Store, Module, Instance
|
|
from wasmer_compiler_cranelift import Compiler
|
|
|
|
store = Store(engine.JIT(Compiler))
|
|
module = Module(store, open('Wasm.wasm', 'rb').read())
|
|
instance = Instance(module)
|
|
result = instance.exports.encrypt(1, 2)
|
|
print(result)
|