Skip to content

Commit

Permalink
*update engine package
Browse files Browse the repository at this point in the history
*rmv encryption
  • Loading branch information
ethan-crypto committed Feb 18, 2024
1 parent b32e524 commit e753eb3
Show file tree
Hide file tree
Showing 6 changed files with 2,595 additions and 5,608 deletions.
2 changes: 1 addition & 1 deletion app/EngineContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const SharedResourcesProvider: React.FC<
// Initialize the WASM module
const engine = await import('@ezkljs/engine/web/ezkl.js')
setEngine(engine)
await (engine as any).default(undefined, new WebAssembly.Memory({ initial: 20, maximum: 4096, shared: true }))
await (engine as any).default(undefined, new WebAssembly.Memory({ initial: 20, maximum: 65536, shared: true }))
// For human readable wasm debug errors call this function
engine.init_panic_hook()
// Initialize the utils module
Expand Down
43 changes: 1 addition & 42 deletions app/Utils.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { useEffect, useRef } from 'react'
import {
elgamalGenRandom,
elgamalEncrypt,
elgamalDecrypt,
prove,
poseidonHash,
verify,
Expand Down Expand Up @@ -187,44 +184,6 @@ export async function handleGenProofButton<T extends FileMapping>(files: T) {
executionTime: end - start,
}
}

export function handleGenREVButton(): Uint8Array {
const seed = generate256BitSeed()
return elgamalGenRandom(seed)
}

export async function handleGenElgamalEncryptionButton<T extends FileMapping>(
files: T,
): Promise<Uint8ArrayResult> {
const result = await convertFilesToFilesSer(files)

const start = performance.now() // Start the timer

let output = elgamalEncrypt(result['pk'], result['message'], result['r'])

const end = performance.now() // End the timer

return {
output: output,
executionTime: end - start,
}
}

export async function handleGenElgamalDecryptionButton<T extends FileMapping>(
files: T,
): Promise<Uint8ArrayResult> {
const result = await convertFilesToFilesSer(files)
const start = performance.now() // Start the timer

let output = elgamalDecrypt(result['cipher'], result['sk'])

const end = performance.now() // End the timer

return {
output: output,
executionTime: end - start,
}
}
export async function handleGenWitnessButton<T extends FileMapping>(
files: T,
): Promise<Uint8ArrayResult> {
Expand All @@ -251,7 +210,7 @@ export async function handleGenVkButton<T extends FileMapping>(
const result = await convertFilesToFilesSer(files)
const start = performance.now() // Start the timer

let output = genVk(result['compiled_onnx'], result['srs'])
let output = genVk(result['compiled_onnx'], result['srs'], false)

const end = performance.now() // End the timer

Expand Down
3 changes: 0 additions & 3 deletions app/components/APINavColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ function NavList() {
<li className='h-14 text-slate-500'>
<Link href='/hashing'>Hashing</Link>
</li>
<li className='h-14 text-slate-500'>
<Link href='/encryption'>Encryption</Link>
</li>
<li className='h-14 text-slate-500'>
<Link href='/prove'>Prove</Link>
</li>
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"test": "jest"
},
"dependencies": {
"@ezkljs/engine": "^3.10.0",
"@ezkljs/engine": "^8.3.0",
"@ezkljs/verify": "^0.0.8",
"@fortawesome/fontawesome-svg-core": "^6.4.2",
"@fortawesome/free-solid-svg-icons": "^6.4.2",
Expand Down Expand Up @@ -55,4 +55,4 @@
"jest": "^29.7.0",
"prettier": "^3.1.0"
}
}
}
Loading

0 comments on commit e753eb3

Please sign in to comment.