Skip to content

Commit bd6973c

Browse files
authored
Merge pull request #48 from dajiaji/update-bench
Update bench from Kyber to MlKem.
2 parents a2bb44a + 17264ca commit bd6973c

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<div align="center">
44
<a href="https://jsr.io/@dajiaji/mlkem"><img src="https://jsr.io/badges/@dajiaji/mlkem" alt="JSR"/></a>
5+
<a href="https://www.npmjs.com/package/mlkem"><img src="https://img.shields.io/npm/v/mlkem?color=%23EE3214" alt="NPM"/></a>
56
<img src="https://github.com/dajiaji/crystals-kyber-js/actions/workflows/ci_browsers.yml/badge.svg" alt="Browser CI" />
67
<img src="https://github.com/dajiaji/crystals-kyber-js/actions/workflows/ci_node.yml/badge.svg" alt="Node.js CI" />
78
<img src="https://github.com/dajiaji/crystals-kyber-js/actions/workflows/ci_deno.yml/badge.svg" alt="Deno CI" />
@@ -44,8 +45,8 @@ This repository has the following packages:
4445

4546
| package | registry | description |
4647
| ----------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
47-
| crystals-kyber-js | [![npm](https://img.shields.io/npm/v/crystals-kyber-js?color=%234C48FF)](https://www.npmjs.com/package/crystals-kyber-js) | `v1.x` implements CRYSTALS-KYBER, and `v2.x-` implements ML-KEM (FIPS 203). `crystals-kyber-js` may become deprecated in the near future. Instead, we recommend switching to the following `mlkem` or `@dajiaji/mlkem`. |
48-
| mlkem | [![npm](https://img.shields.io/npm/v/mlkem?color=%234C48FF)](https://www.npmjs.com/package/mlkem) | Implements only ML-KEM (FIPS 203). It is an alias for the above `crystals-kyber-js` starting from `v2` onwards. We recommend using this package going forward. |
48+
| crystals-kyber-js | [![npm](https://img.shields.io/npm/v/crystals-kyber-js?color=%23EE3214)](https://www.npmjs.com/package/crystals-kyber-js) | `v1.x` implements CRYSTALS-KYBER, and `v2.x-` implements ML-KEM (FIPS 203). `crystals-kyber-js` may become deprecated in the near future. Instead, we recommend switching to the following `mlkem` or `@dajiaji/mlkem`. |
49+
| mlkem | [![npm](https://img.shields.io/npm/v/mlkem?color=%23EE3214)](https://www.npmjs.com/package/mlkem) | Implements only ML-KEM (FIPS 203). It is an alias for the above `crystals-kyber-js` starting from `v2` onwards. We recommend using this package going forward. |
4950
| @dajiaji/mlkem | [![JSR](https://jsr.io/badges/@dajiaji/mlkem)](https://jsr.io/@dajiaji/mlkem) | Implements only ML-KEM (FIPS 203). It is an ML-KEM package for [jsr.io](https://jsr.io/). The above `mlkem` is an npm package of `@dajiaji/mlkem`, which has been converted using [@deno/dnt](https://github.com/denoland/dnt). |
5051

5152
For Node.js, you can install `mlkem` or `crystals-kyber-js` via npm, yarn or

bench/kyber1024.bench.ts renamed to bench/mlKem1024.bench.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as kyber from "npm:crystals-kyber";
2-
import { Kyber1024 } from "../mod.ts";
2+
import { MlKem1024 } from "../mod.ts";
33

44
Deno.bench("deriveKeyPair", async (b) => {
5-
const ctx = new Kyber1024();
5+
const ctx = new MlKem1024();
66
const seed = new Uint8Array(64);
77
globalThis.crypto.getRandomValues(seed);
88
b.start();
@@ -11,7 +11,7 @@ Deno.bench("deriveKeyPair", async (b) => {
1111
});
1212

1313
Deno.bench("generateKeyPair", async (b) => {
14-
const ctx = new Kyber1024();
14+
const ctx = new MlKem1024();
1515
b.start();
1616
const [_pk, _sk] = await ctx.generateKeyPair();
1717
b.end();
@@ -22,7 +22,7 @@ Deno.bench("crystals-kyber:KeyGen1024", () => {
2222
});
2323

2424
Deno.bench("encap", async (b) => {
25-
const ctx = new Kyber1024();
25+
const ctx = new MlKem1024();
2626
const [pk, _sk] = await ctx.generateKeyPair();
2727
b.start();
2828
const [_ct, _ss] = await ctx.encap(pk);
@@ -37,7 +37,7 @@ Deno.bench("crystals-kyber:Encrypt1024", (b) => {
3737
});
3838

3939
Deno.bench("decap", async (b) => {
40-
const ctx = new Kyber1024();
40+
const ctx = new MlKem1024();
4141
const [pk, sk] = await ctx.generateKeyPair();
4242
const [ct, _ss1] = await ctx.encap(pk);
4343
b.start();
@@ -54,7 +54,7 @@ Deno.bench("crystals-kyber:Decrypt1024", (b) => {
5454
});
5555

5656
Deno.bench("all - generateKeyPair/encap/decap", async (b) => {
57-
const ctx = new Kyber1024();
57+
const ctx = new MlKem1024();
5858
b.start();
5959
const [pk, sk] = await ctx.generateKeyPair();
6060
const [ct, _ss1] = await ctx.encap(pk);

bench/kyber512.bench.ts renamed to bench/mlKem512.bench.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as kyber from "npm:crystals-kyber";
2-
import { Kyber512 } from "../mod.ts";
2+
import { MlKem512 } from "../mod.ts";
33

44
Deno.bench("deriveKeyPair", async (b) => {
5-
const ctx = new Kyber512();
5+
const ctx = new MlKem512();
66
const seed = new Uint8Array(64);
77
globalThis.crypto.getRandomValues(seed);
88
b.start();
@@ -11,7 +11,7 @@ Deno.bench("deriveKeyPair", async (b) => {
1111
});
1212

1313
Deno.bench("generateKeyPair", async (b) => {
14-
const ctx = new Kyber512();
14+
const ctx = new MlKem512();
1515
b.start();
1616
const [_pk, _sk] = await ctx.generateKeyPair();
1717
b.end();
@@ -22,7 +22,7 @@ Deno.bench("crystals-kyber:KeyGen512", () => {
2222
});
2323

2424
Deno.bench("encap", async (b) => {
25-
const ctx = new Kyber512();
25+
const ctx = new MlKem512();
2626
const [pk, _sk] = await ctx.generateKeyPair();
2727
b.start();
2828
const [_ct, _ss] = await ctx.encap(pk);
@@ -37,7 +37,7 @@ Deno.bench("crystals-kyber:Encrypt512", (b) => {
3737
});
3838

3939
Deno.bench("decap", async (b) => {
40-
const ctx = new Kyber512();
40+
const ctx = new MlKem512();
4141
const [pk, sk] = await ctx.generateKeyPair();
4242
const [ct, _ss1] = await ctx.encap(pk);
4343
b.start();
@@ -54,7 +54,7 @@ Deno.bench("crystals-kyber:Decrypt512", (b) => {
5454
});
5555

5656
Deno.bench("all - generateKeyPair/encap/decap", async (b) => {
57-
const ctx = new Kyber512();
57+
const ctx = new MlKem512();
5858
b.start();
5959
const [pk, sk] = await ctx.generateKeyPair();
6060
const [ct, _ss1] = await ctx.encap(pk);

bench/kyber768.bench.ts renamed to bench/mlKem768.bench.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as kyber from "npm:crystals-kyber";
2-
import { Kyber768 } from "../mod.ts";
2+
import { MlKem768 } from "../mod.ts";
33

44
Deno.bench("deriveKeyPair", async (b) => {
5-
const ctx = new Kyber768();
5+
const ctx = new MlKem768();
66
const seed = new Uint8Array(64);
77
globalThis.crypto.getRandomValues(seed);
88
b.start();
@@ -11,7 +11,7 @@ Deno.bench("deriveKeyPair", async (b) => {
1111
});
1212

1313
Deno.bench("generateKeyPair", async (b) => {
14-
const ctx = new Kyber768();
14+
const ctx = new MlKem768();
1515
b.start();
1616
const [_pk, _sk] = await ctx.generateKeyPair();
1717
b.end();
@@ -22,7 +22,7 @@ Deno.bench("crystals-kyber:KeyGen768", () => {
2222
});
2323

2424
Deno.bench("encap", async (b) => {
25-
const ctx = new Kyber768();
25+
const ctx = new MlKem768();
2626
const [pk, _sk] = await ctx.generateKeyPair();
2727
b.start();
2828
const [_ct, _ss] = await ctx.encap(pk);
@@ -37,7 +37,7 @@ Deno.bench("crystals-kyber:Encrypt768", (b) => {
3737
});
3838

3939
Deno.bench("decap", async (b) => {
40-
const ctx = new Kyber768();
40+
const ctx = new MlKem768();
4141
const [pk, sk] = await ctx.generateKeyPair();
4242
const [ct, _ss1] = await ctx.encap(pk);
4343
b.start();
@@ -54,7 +54,7 @@ Deno.bench("crystals-kyber:Decrypt768", (b) => {
5454
});
5555

5656
Deno.bench("all - generateKeyPair/encap/decap", async (b) => {
57-
const ctx = new Kyber768();
57+
const ctx = new MlKem768();
5858
b.start();
5959
const [pk, sk] = await ctx.generateKeyPair();
6060
const [ct, _ss1] = await ctx.encap(pk);

0 commit comments

Comments
 (0)