Created
October 3, 2025 10:01
-
-
Save onliniak/e8e7df5d20a32b385641069aeccfcfc6 to your computer and use it in GitHub Desktop.
Generate public key from password
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ml_kem1024 } from '@noble/post-quantum/ml-kem.js'; | |
//import { randomBytes } from '@noble/post-quantum/utils.js'; | |
function stringToUint8Array(inputString) { | |
// Use TextEncoder to encode the string into a Uint8Array | |
const encoder = new TextEncoder(); | |
return encoder.encode(inputString); | |
} | |
const myString = 'û黤¼S¨rW÷nè/8T[ÍÊ3¢½¿1ÏüìÔ8_ÒZ~tô4±ZËkì¥'; //41 | |
const uint8Array = stringToUint8Array(myString); | |
//const seed = randomBytes(64); // seed is optional | |
const seed = uint8Array | |
const aliceKeys = ml_kem1024.keygen(seed); | |
//const { cipherText, sharedSecret: bobShared } = ml_kem1024.encapsulate(aliceKeys.publicKey); | |
//const aliceShared = ml_kem768.decapsulate(cipherText, aliceKeys.secretKey); | |
const BtoA = btoa(aliceKeys.publicKey); | |
console.log(BtoA); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Myślałem nad systemem logowania do stron statycznych i pomyślałem o BitCoinie.
Sieć nie musi mieć żadnego systemu logowania, ponieważ każdy jej użytkownik ma na komputerze plik z hasłem.
Oczywiście moje ciężko zdobyte w Faucetach Bitcoiny zniknęły przez błąd danych na PenDrivie
więc szukałem czegoś prostszego do przechowywania. Spróbuj wsadzić parę kluczy do menedżera haseł.
I wymyśliłem sobie coś takiego: Mam tu losowe 41 znakowe hasło złożone z rozszerzonej łaciny i znaków specjalnych.
System bierze hasło i tworzy mi parę kluczy na żądanie, ja nie muszę nigdzie trzymać żadnych plików .rsa
Jednocześnie jeśli chcę się zalogować to:
w jakimś menedżerze haseł z komputera na telefon.