sodium-javascript/fe25519_25/fe25519_invert.js

62 lines
6.5 KiB
JavaScript
Raw Normal View History

module.exports = loadWebAssembly
loadWebAssembly.supported = typeof WebAssembly !== 'undefined'
function loadWebAssembly (opts) {
if (!loadWebAssembly.supported) return null
var imp = opts && opts.imports
2020-10-15 23:10:52 +00:00
var wasm = toUint8Array('AGFzbQEAAAABHQJgFH5+fn5+fn5+fn5+fn5+fn5+fn5+AGACf38AAwMCAAEFAwEAAQYzCn4BQgALfgFCAAt+AUIAC34BQgALfgFCAAt+AUIAC34BQgALfgFCAAt+AUIAC34BQgALBxsCBm1lbW9yeQIADmZlMjU1MTlfaW52ZXJ0AAEKqx0Csw8BfH4gAKesIQAgAaesIQEgAqesIQIgA6esIQMgBKesIQQgBaesIQUgBqesIQYgB6esIQcgCKesIQggCaesIQkgCqesIQogC6esIQsgDKesIQwgDaesIQ0gDqesIQ4gD6esIQ8gEKesIRAgEaesIREgEqesIRIgE6esIRNCEyALfiALQoCAgIAIg0IBhkITfn0hHkITIAx+IAxCgICAgAiDQgGGQhN+fSEfQhMgDX4gDUKAgICACINCAYZCE359ISBCEyAOfiAOQoCAgIAIg0IBhkITfn0hIUITIA9+IA9CgICAgAiDQgGGQhN+fSEiQhMgEH4gEEKAgICACINCAYZCE359ISNCEyARfiARQoCAgIAIg0IBhkITfn0hJEITIBJ+IBJCgICAgAiDQgGGQhN+fSElQhMgE34gE0KAgICACINCAYZCE359ISZCAiABfiABQoCAgIAIg0IBhkICfn0hJ0ICIAN+IANCgICAgAiDQgGGQgJ+fSEoQgIgBX4gBUKAgICACINCAYZCAn59ISlCAiAHfiAHQoCAgIAIg0IBhkICfn0hKkICIAl+IAlCgICAgAiDQgGGQgJ+fSErIB6nrCEeIB+nrCEfICCnrCEgICGnrCEhICKnrCEiICOnrCEjICSnrCEkICWnrCElICanrCEmICenrCEnICinrCEoICmnrCEpICqnrCEqICunrCErIAAgCn4hLCAAIAt+IS0gACAMfiEuIAAgDX4hLyAAIA5+ITAgACAP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HyMHISIjCCElIwkhKCMAIwEjAiMDIwQjBSMGIwcjCCMJIwAjASMCIwMjBCMFIwYjByMIIwkQACMAIwEjAiMDIwQjBSMGIwcjCCMJIwAjASMCIwMjBCMFIwYjByMIIwkQACACIAMgBCAFIAYgByAIIAkgCiALIwAjASMCIwMjBCMFIwYjByMIIwkQACMAIQ4jASERIwIhFCMDIRcjBCEaIwUhHSMGISAjByEjIwghJiMJISkgDiARIBQgFyAaIB0gICAjICYgKSANIBAgEyAWIBkgHCAfICIgJSAoEAAjACENIwEhECMCIRMjAyEWIwQhGSMFIRwjBiEfIwchIiMIISUjCSEoIwAjASMCIwMjBCMFIwYjByMIIwkjACMBIwIjAyMEIwUjBiMHIwgjCRAAIwAhDyMBIRIjAiEVIwMhGCMEIRsjBSEeIwYhISMHISQjCCEnIwkhKiAOIBEgFCAXIBogHSAgICMgJiApIwAjASMCIwMjBCMFIwYjByMIIwkQACMAIQ4jASERIwIhFCMDIRcjBCEaIwUhHSMGISAjByEjIwghJiMJISkCQANAQQUgDEYNASAMQQFqIQwjACMBIwIjAyMEIwUjBiMHIwgjCSMAIwEjAiMDIwQjBSMGIwcjCCMJEAAMAAsLQQAhDCMAIQ8jASESIwIhFSMDIRgjBCEbIwUhHiMGISEjByEkIwghJyMJISogDiARIBQgFyAaIB0gICAjICYgKSMAIwEjAiMDIwQjBSMGIwcjCCMJEAAjACEOIwEhESMCIRQjAyEXIwQhGiMFIR0jBiEgIwchIyMIISYjCSEpAkADQEEKIAxGDQEgDEEBaiEMIwAjASMCIwMjBCMFIwYjByMIIwkjACMBIwIjAyMEIwUjBiMHIwgjCRAADAALC0EAIQwgDiARIBQgFyAaIB0gICAjICYgKSMAIwEjAiMDIwQjBSMGIwcjCCMJEAAjACEPIwEhEiMC
var ready = null
var mod = {
buffer: wasm,
memory: null,
exports: null,
realloc: realloc,
onload: onload
}
onload(function () {})
return mod
function realloc (size) {
mod.exports.memory.grow(Math.max(0, Math.ceil(Math.abs(size - mod.memory.length) / 65536)))
mod.memory = new Uint8Array(mod.exports.memory.buffer)
}
function onload (cb) {
if (mod.exports) return cb()
if (ready) {
ready.then(cb.bind(null, null)).catch(cb)
return
}
try {
if (opts && opts.async) throw new Error('async')
setup({instance: new WebAssembly.Instance(new WebAssembly.Module(wasm), imp)})
} catch (err) {
ready = WebAssembly.instantiate(wasm, imp).then(setup)
}
onload(cb)
}
function setup (w) {
mod.exports = w.instance.exports
mod.memory = mod.exports.memory && mod.exports.memory.buffer && new Uint8Array(mod.exports.memory.buffer)
}
}
function toUint8Array (s) {
if (typeof atob === 'function') return new Uint8Array(atob(s).split('').map(charCodeAt))
return (require('buf' + 'fer').Buffer).from(s, 'base64')
}
function charCodeAt (c) {
return c.charCodeAt(0)
}