Skip to content

proximax-storage/rust-xpx-crypto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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());
}

About

Crypto Package for ProximaX Sirius Blockchain Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages