xpx-chain-crypto

Crates.ioxpx-chain-crypto
lib.rsxpx-chain-crypto
version1.0.8
sourcesrc
created_at2024-06-27 15:34:11.737458
updated_at2024-06-27 15:47:24.146179
descriptionFast and efficient ed25519 EdDSA key generations, signing, and verification in pure Rust.
homepagehttps://proximax.io
repositoryhttps://github.com/proximax-storage/rust-xpx-chain-sdk/crypto
max_upload_size
id1285887
size92,208
Rust Latam (RustLangLatam)

documentation

README

Rust logo

ProximaX Sirius Blockchain Crypto Rust

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.

Usage

First, add this to your Cargo.toml:

[dependencies]
xpx-chain-crypto = { git = "https://github.com/proximax-storage/rust-xpx-crypto" }

Example

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());
}
Commit count: 289

cargo fmt