Skip to content
rdancer edited this page Sep 25, 2010 · 24 revisions

Calculator

Workflow

Completed tasks are crossed through

JavaScript NaCl Server
Send page to browser
Render page Render page
Obtain formula from user
Pass formula to NaCl
Pre-process formula (using our FHE library) into boolean circuit + data
Parse the formula and replace numbers with variables; encrypt numbers
Base64-encode BigInts
Translate internal structures into XML
Call returns XML-RPC-encoded circuit + data request from NaCl Return XML-RPC-encoded circuit + data request to JS
Send the XML-RPC request to server Receive XML-RPC boolean circuit + data
Process it (using our FHE library)
Receive XML-RPC-encoded result Return XML-RPC-encoded result
Pass XML-RPC-encoded result to NaCl Receive XML-RPC-encoded result
Decode XML-RPC-encoded result
Call returns the result Return result to JS
Display result

Remarks:

  • BigNums are represented in XML-RPC as big-endian 2-complement, base-64-encoded
  • BigFloats are represented in XML-RPC as XXX, base-64-encoded
    Simple text input of a calculator, with a submit button, optional throbber which will spin while computation is in progress, and a result display. Optional formula + result history.

Mockup

1 + 1 = 2 ← [throbber] in place of result while calculation is in progress
[last formula & result]
[second last formula & result]
[third last formula & result]

FHE Library

Required Operations

§3.2 of Gentry (2010)

  • Generate x-bit BigInt
  • Add
  • Multiply
  • Modulo (as defined in the paper)
  • Compile formula into boolean circuit comprised of AND and XOR gates

Possibly Useful Libraries

Clone this wiki locally