Mercurial > core / rust/lib/crypto/src/lib.rs
changeset 698: |
96958d3eb5b0 |
parent: |
4f49127c9048
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Fri, 04 Oct 2024 22:04:59 -0400 |
permissions: |
-rw-r--r-- |
description: |
fixes |
7 use con::{PUBLIC_KEY_LENGTH, SECRET_KEY_LENGTH}; 9 pub use salsa20::{self, XSalsa20}; 10 // use ed25519::signature::Signature as _; 14 pub fn gen_keypair<S: AsRef<[u8]>, P: AsRef<[u8]>>( 18 let sec_bytes: Vec<u8> = FromHex::from_hex(secret_key).unwrap(); 19 let pub_bytes: Vec<u8> = FromHex::from_hex(public_key).unwrap(); 20 let secret: SecretKey = 21 SecretKey::from_bytes(&sec_bytes[..SECRET_KEY_LENGTH]).unwrap(); 22 let public: PublicKey = 23 PublicKey::from_bytes(&pub_bytes[..PUBLIC_KEY_LENGTH]).unwrap(); 25 Keypair { secret, public }