Skip to content

UneBaguette/xwing.wasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xwing-wasm

X-Wing hybrid KEM (ML-KEM-768 + X25519) with WASM bindings.

Built in Rust on x-wing.

X-Wing is a post-quantum/traditional hybrid key encapsulation mechanism. If either X25519 or ML-KEM-768 remains secure, X-Wing remains secure.

Install

npm install xwing-wasm

Usage

import { generateKeypair, encapsulate, decapsulate } from 'xwing-wasm';

// Generate keypair (32-byte secret key + 1216-byte public key)
const { secretKey, publicKey } = generateKeypair();

// Encapsulate: produce shared key + ciphertext from public key
const { sharedKey, ciphertext } = encapsulate(publicKey);

// Decapsulate: recover shared key from secret key + ciphertext
const recoveredKey = decapsulate(secretKey, ciphertext);

// sharedKey === recoveredKey

Sizes

Value Size
Secret key (decapsulation) 32 bytes
Public key (encapsulation) 1,216 bytes
Ciphertext 1,120 bytes
Shared key 32 bytes

Native Rust usage

use xwing_wasm_rs::*;

let kp = generate_keypair();
let enc = encapsulate(&kp.pk).unwrap();
let ss = decapsulate(&kp.sk, &enc.ciphertext);

assert_eq!(enc.shared_key, *ss);

Security

License

Dual-licensed under the MIT License or Apache-2.0 License.

About

xwing powered by WebAssembly

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Contributors