Skip to content

Commit

Permalink
Merge pull request #452 from dajiaji/fix-bug-on-combiner
Browse files Browse the repository at this point in the history
FIx bug on combiner.
  • Loading branch information
dajiaji authored Nov 5, 2024
2 parents 30caa7e + 9742e1d commit 13f1bd6
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 32 deletions.
16 changes: 5 additions & 11 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion import_map.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"imports": {
"@dajiaji/mlkem": "npm:mlkem@^2.2.0",
"@dajiaji/mlkem": "npm:mlkem@^2.3.0",
"@noble/ciphers/chacha": "npm:@noble/ciphers@^1.0.0/chacha",
"@noble/curves/ed25519": "npm:@noble/curves@^1.6.0/ed25519",
"@noble/curves/ed448": "npm:@noble/curves@^1.6.0/ed448",
Expand Down
2 changes: 1 addition & 1 deletion npm/import_map.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"imports": {
"@dajiaji/mlkem": "npm:mlkem@^2.2.0",
"@dajiaji/mlkem": "npm:mlkem@^2.3.0",
"@deno/dnt": "jsr:@deno/dnt@^0.41.3",
"@hpke/chacha20poly1305": "npm:@hpke/chacha20poly1305@^1.4.3",
"@hpke/common": "npm:@hpke/common@^1.4.3",
Expand Down
56 changes: 43 additions & 13 deletions npm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/hybridkem-x-wing/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.2.0",
"exports": "./mod.ts",
"imports": {
"@dajiaji/mlkem": "jsr:@dajiaji/mlkem@^2.2.0",
"@dajiaji/mlkem": "jsr:@dajiaji/mlkem@^2.3.0",
"@noble/hashes": "npm:@noble/hashes@^1.5.0"
},
"publish": {
Expand Down
2 changes: 1 addition & 1 deletion packages/hybridkem-x-wing/src/hybridkemXWing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const X25519_BASE = new Uint8Array([
// "/^\",
// );
// deno-fmt-ignore
const XWING_LABEL = new Uint8Array([46, 47, 47, 94, 92]);
const XWING_LABEL = new Uint8Array([92, 46, 47, 47, 94, 92]);

function emitNotSupported<T>(): Promise<T> {
return new Promise((_resolve, reject) => {
Expand Down
13 changes: 9 additions & 4 deletions packages/hybridkem-x-wing/test/hybridkemXWing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ describe("HybridkemXWing", () => {
new Uint8Array(await recipient.serializePrivateKey(kp.privateKey)),
sk,
);
// assertEquals(
// new Uint8Array(await kem.serializePublicKey(kp.publicKey)),
// pk,
// );
assertEquals(
new Uint8Array(await recipient.serializePublicKey(kp.publicKey)),
pk,
);
const sender = new HybridkemXWing();
const res = await sender.encap({
recipientPublicKey: kp.publicKey,
Expand All @@ -58,7 +58,12 @@ describe("HybridkemXWing", () => {
enc: res.enc,
recipientKey: kp.privateKey,
});
assertEquals(res.enc.byteLength, 1120);
assertEquals(res.sharedSecret.byteLength, 32);
assertEquals(res.enc, ct);
assertEquals(res.sharedSecret, ssR);
assertEquals(res.sharedSecret, ss);
// assertEquals(ssR, ss);
}
});
});
Expand Down
Loading

0 comments on commit 13f1bd6

Please sign in to comment.