Multi-Oracle Structured Algebraic Intractability Composition.
The next generation of post-quantum cryptography, combining Lattices,
Tensors, and Graphs.
Combines Sparse Lattice Subset Sum, Tensor Decomposition, and Expander Graph Random Walk problems for unmatched security.
Optimized Go implementation for blazing fast key generation, encapsulation, and signing operations.
Available as a high-performance Go module and a flexible Node.js/Bun library for web integration.
In-depth resources to understand the mathematics and implementation.
Choose your preferred language to begin.
package main
import (
"fmt"
"log"
"github.com/BackendStack21/k-mosaic-go"
"github.com/BackendStack21/k-mosaic-go/kem"
)
func main() {
// 1. Generate Key Pair (MOS_128)
kp, err := kem.GenerateKeyPair(kmosaic.MOS_128)
if err != nil {
log.Fatal(err)
}
// 2. Encapsulate (Sender)
result, _ := kem.Encapsulate(&kp.PublicKey)
fmt.Printf("Shared Secret: %x\n", result.SharedSecret[:16])
// 3. Decapsulate (Receiver)
secret, _ := kem.Decapsulate(&kp.SecretKey, &kp.PublicKey, &result.Ciphertext)
fmt.Printf("Recovered: %x\n", secret[:16])
}
import {
kemGenerateKeyPair,
encapsulate,
decapsulate,
SecurityLevel
} from 'k-mosaic';
async function main() {
// 1. Generate Key Pair
const { publicKey, secretKey } = await kemGenerateKeyPair(SecurityLevel.MOS_128);
// 2. Encapsulate (Sender)
const { ciphertext, sharedSecret } = await encapsulate(publicKey);
console.log('Shared Secret:', sharedSecret);
// 3. Decapsulate (Receiver)
const recovered = await decapsulate(ciphertext, secretKey, publicKey);
console.log('Recovered:', recovered);
}
main();
Comparison of core operations (MOS-128 Security Level)
| Operation |
|
|
|---|---|---|
| KEM Key Generation | 6.29 ms | 19.70 ms |
| KEM Encapsulate | 0.32 ms | 0.52 ms |
| KEM Decapsulate | 0.38 ms | 6.32 ms |
| Sign Key Generation | 6.22 ms | 19.63 ms |
| Sign Message | 0.012 ms | 0.038 ms |
| Verify Signature | 2.44 ms | 1.45 ms |
* Benchmarks run on Apple M2 Pro. Go implementation is recommended for high-performance applications.
Manage keys and operations directly from your terminal using the Go-based CLI.