Improvement of a JavaScript cryptographic library performance with - - PowerPoint PPT Presentation

improvement of a javascript cryptographic
SMART_READER_LITE
LIVE PREVIEW

Improvement of a JavaScript cryptographic library performance with - - PowerPoint PPT Presentation

Improvement of a JavaScript cryptographic library performance with big numbers Master Semester Project Julien von Felten Supervisor: Gaylor Bosson Responsible: Prof. Bryan Ford DEDIS, EPFL January 2020 1/11 Table of Contents Introduction


slide-1
SLIDE 1

Improvement of a JavaScript cryptographic library performance with big numbers

Supervisor: Gaylor Bosson Responsible: Prof. Bryan Ford DEDIS, EPFL January 2020

Master Semester Project

Julien von Felten

1/11

slide-2
SLIDE 2

Introduction Design of the optimizations Results Future work Conclusion

Table of Contents

2/11

slide-3
SLIDE 3

Introduction

Kyber

  • Developed in Go
  • Adapted in JS for status.dedis.ch
  • JavaScript numbers < 𝟑𝟔𝟒
  • Uses bn.js library for big integers
  • No verification of links for the

SkipChain Project

  • Benchmark
  • Optimizations
  • BigInt
  • Modulus
  • Pool

Each optimization implemented on top

  • f each other

3/11

slide-4
SLIDE 4

Benchmark

Library used: Performance MDN API for browser performance Measure of the time of:

  • N signatures and each

signature

  • N verifications and each

verification N = [2, 10, 100, 500, 1000]

  • Min, Max, Avg computed

4/11

slide-5
SLIDE 5

First optimization: BigInt

Replacing BNType by BigInt BN.js: BNType, represented by array Implementation of more complex function than operators

5/11

slide-6
SLIDE 6

Second optimization: Modulus

55% of time spent for modulus computation Modulus functions used in higher abstraction level functions (𝑩 𝐧𝐩𝐞 𝒐 ∗ B mod n) mod n = (𝑩 ∗ B ) mod n

6/11

slide-7
SLIDE 7

Third optimization: Memory Pool

Memory pool: Group of objects in memory ready to be used Package deePool and mutable classes 318,000,000 gfp and 90,000,000 gfp2

  • bjects created for N = 1000

7/11

slide-8
SLIDE 8

Results of the optimizations

Master BigInt Modulus Pool Minimum 166.3 [ms] 54.91 [ms] 33.36 [ms] 36.46 [ms] Average 180.26 [ms] 58.21 [ms] 36.92 [ms] 41.08 [ms] Maximum 222.79 [ms] 73.12 [ms] 55.9 [ms] 59.26 [ms] Ratio 5.5 5.08 3.21 3.6

Values

  • btained

for 1000 verification keys Ratio: time verification / time signature 8/11

slide-9
SLIDE 9

Chrome, Opera, Edge, NodeJs: v8 engine Firefox: SpiderMonkey engine NodeJS: more layers with event loop, low-level I/O API, file system I/O Best value

  • btained:

28.6ms on Chrome Windows

Results of the comparison of the browsers and NodeJS

9/11

slide-10
SLIDE 10

Future work

Instead of BigInt: concatenation

  • f two numbers

Use even fewer modulus Different package of memory pool or own implementation Optimization for NodeJS

10/11

slide-11
SLIDE 11

Conclusion

Kyber can be improved more than 4.76 Key verification under 30ms Memory in JS is optimized, memory pool not needed BigInt type is working well but depends on browsers Fewer Modulus can be used

11/11