Skip to content

Commit

Permalink
feat: use Wasm to compute email addr
Browse files Browse the repository at this point in the history
  • Loading branch information
rnmeow committed Oct 5, 2024
1 parent 1870675 commit 52bbb6a
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,23 @@
import VueWriter from 'vue-writer'
import { SOCIAL_LINKS } from '@/config/links'
const arr = [
0x64, 0x47, 0x39, 0x31, 0x59, 0x32, 0x68, 0x41, 0x63, 0x6d, 0x35, 0x74, 0x5a, 0x57, 0x39, 0x33,
0x4c, 0x6d, 0x4e, 0x76, 0x62, 0x51, 0x3d, 0x3d
]
if (process.client) {
localStorage.setItem('email', atob(String.fromCharCode.apply(null, arr)))
const { instance } = await WebAssembly.instantiate(
new Uint8Array([
0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 127, 3, 3, 2, 0, 0, 5, 3, 1, 0, 1, 7, 44, 3,
6, 109, 101, 109, 111, 114, 121, 2, 0, 14, 103, 101, 116, 95, 115, 116, 114, 105, 110, 103,
95, 112, 116, 114, 0, 0, 14, 103, 101, 116, 95, 115, 116, 114, 105, 110, 103, 95, 108, 101,
110, 0, 1, 10, 11, 2, 4, 0, 65, 0, 11, 4, 0, 65, 16, 11, 11, 22, 1, 0, 65, 0, 11, 16, 116,
111, 117, 99, 104, 64, 114, 110, 109, 101, 111, 119, 46, 99, 111, 109
])
)
const memory = instance.exports.memory as WebAssembly.Memory
const ptr = (instance.exports.get_string_ptr as CallableFunction)() as number
const len = (instance.exports.get_string_len as CallableFunction)() as number
const arr = new Uint8Array(memory.buffer, ptr, len)
localStorage.setItem('email', String.fromCharCode.apply(null, Array.from(arr)))
}
const emailAddr = ref('')
Expand Down

0 comments on commit 52bbb6a

Please sign in to comment.