Crates.io | xpx-chain-crypto |
lib.rs | xpx-chain-crypto |
version | 1.0.8 |
source | src |
created_at | 2024-06-27 15:34:11.737458 |
updated_at | 2024-06-27 15:47:24.146179 |
description | Fast and efficient ed25519 EdDSA key generations, signing, and verification in pure Rust. |
homepage | https://proximax.io |
repository | https://github.com/proximax-storage/rust-xpx-chain-sdk/crypto |
max_upload_size | |
id | 1285887 |
size | 92,208 |
Official ProximaX Sirius Blockchain implementation ed26619 encryption modules for Rust.
The ProximaX Sirius Blockchain Crypto Rust works as a lightweight Rust library for interacting with the Sirius Blockchain.
First, add this to your Cargo.toml
:
[dependencies]
xpx-chain-crypto = { git = "https://github.com/proximax-storage/rust-xpx-crypto" }
use xpx_chain_crypto::{Keypair, PublicKey, SecretKey, Signature};
fn main() {
let sk_hex =
hex::decode("68f50e10e5b8be2b7e9ddb687a667d6e94dd55fe02b4aed8195f51f9a242558b").unwrap();
let message: &[u8] = b"ProximaX Limited";
let secret_key: SecretKey = SecretKey::from_bytes(&sk_hex).unwrap();
println!("PrivateKey: {:?}", hex::encode(secret_key.to_bytes()));
let public_key: PublicKey = PublicKey::from(&secret_key);
println!("PublicKey: \t{:?}", hex::encode(public_key.to_bytes()));
let key_pair = Keypair {
secret: secret_key,
public: public_key,
};
println!("PublicKey: \t{:?}", key_pair.public);
let sig: Signature = key_pair.sign(&message);
println!("Sig: \t\t{:?}", hex::encode(sig.to_bytes().to_vec()));
println!("Verify: \t{}", key_pair.verify(&message, &sig).is_ok());
}