https://github.com/epicchainlabs/epicchain.cryptography.bls12_381.native
Native is a specialized library designed to provide native implementations of cryptographic operations based on the BLS12-381 elliptic curve pairing-friendly curve
https://github.com/epicchainlabs/epicchain.cryptography.bls12_381.native
blockchain-security bls12-cryptography bls12381 cryptographic-operations cryptography-library elliptic-curve-cryptography elliptic-curve-pairing epicchain-security native-library pairing-friendly-curve
Last synced: about 1 year ago
JSON representation
Native is a specialized library designed to provide native implementations of cryptographic operations based on the BLS12-381 elliptic curve pairing-friendly curve
- Host: GitHub
- URL: https://github.com/epicchainlabs/epicchain.cryptography.bls12_381.native
- Owner: epicchainlabs
- License: mit
- Created: 2024-07-16T12:20:03.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-07T19:42:15.000Z (almost 2 years ago)
- Last Synced: 2025-02-13T20:49:40.616Z (over 1 year ago)
- Topics: blockchain-security, bls12-cryptography, bls12381, cryptographic-operations, cryptography-library, elliptic-curve-cryptography, elliptic-curve-pairing, epicchain-security, native-library, pairing-friendly-curve
- Language: Rust
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# EpicChain.Cryptography.BLS12_381.Native
## Introduction
Welcome to the comprehensive guide for **`EpicChain.Cryptography.BLS12_381.Native`**, a cutting-edge native library meticulously crafted in Rust. This library offers high-performance and secure implementations of Boneh-Lynn-Shacham (BLS) signatures, utilizing the advanced BLS12-381 curve. As an integral component of the EpicChain ecosystem, this library ensures that cryptographic operations are both fast and robust, meeting the highest standards of security and efficiency.
## Key Features
- **Efficient BLS Signature Computations**: The library provides optimized native implementations of BLS signatures using the BLS12-381 curve, designed to deliver exceptional performance and minimal latency.
- **Advanced Cryptographic Security**: Employs the latest and most secure cryptographic techniques to safeguard your data against potential threats and vulnerabilities.
- **Seamless Interoperability**: Crafted to integrate smoothly with other components within the EpicChain ecosystem, enabling a cohesive and unified blockchain environment.
## Prerequisites
Before diving into the setup and installation, ensure you have the following prerequisites:
- **Rust Programming Language**: You need Rust installed on your system. The recommended version is at least 1.50.0. Rust can be installed via [rustup](https://rustup.rs/), which provides a straightforward installation process.
- **Cargo**: This is Rust's package manager and build system, included with the Rust installation.
## Installation Guide
### 1. Cloning the Repository
To begin, you need to clone the repository to your local machine. This step involves retrieving the source code and setting it up for further use:
```sh
git clone https://github.com/epicchainlabs/EpicChain.Cryptography.BLS12_381.Native.git
cd EpicChain.Cryptography.BLS12_381.Native
```
### 2. Building the Library
With the repository cloned, the next step is to build the library. This process compiles the source code into an executable format:
1. **Navigate to the Cloned Directory**: Ensure you are in the directory where you cloned the repository.
2. **Build the Library Using Cargo**:
```sh
cargo build --release
```
After executing this command, the compiled library will be available in the `target/release` directory. This binary is now ready for integration into your projects.
### 3. Integration
Integrating the library into your project depends on the language you're using. Below are instructions for Rust projects as well as guidance for other languages.
#### Integration with Rust Projects
1. **Add Dependency**: Include `EpicChain.Cryptography.BLS12_381.Native` as a dependency in your `Cargo.toml` file:
```toml
[dependencies]
epicchain-cryptography-bls12_381-native = { path = "../path_to_your_cloned_repo" }
```
2. **Utilize the Library**: Import and use the library in your Rust project:
```rust
extern crate epicchain_cryptography_bls12_381_native;
use epicchain_cryptography_bls12_381_native::{BLSSecretKey, BLSPublicKey, BLSSignature};
fn main() {
// Initialize the library
epicchain_cryptography_bls12_381_native::init();
// Generate key pair
let sk = BLSSecretKey::generate();
let pk = sk.public_key();
// Sign a message
let message = b"Hello, EpicChain!";
let signature = sk.sign(message);
// Verify the signature
let valid = pk.verify(&signature, message);
if valid {
println!("Signature is valid.");
} else {
println!("Signature is invalid.");
}
}
```
#### Integration with Other Languages
For projects in other programming languages such as Python or JavaScript, you will need to use Foreign Function Interfaces (FFI) or bindings. This approach allows you to call the native library functions from these languages. Please consult the documentation specific to the FFI or binding methods applicable to your language of choice.
## Usage Examples
### Example: Generating and Verifying BLS Signatures
#### Generating a BLS Signature
Here's a simple Rust example demonstrating how to generate a BLS signature:
```rust
extern crate epicchain_cryptography_bls12_381_native;
use epicchain_cryptography_bls12_381_native::{BLSSecretKey, BLSSignature};
fn main() {
// Initialize the library
epicchain_cryptography_bls12_381_native::init();
// Generate a secret key
let sk = BLSSecretKey::generate();
// Message to be signed
let message = b"Hello, EpicChain!";
// Generate a signature
let signature = sk.sign(message);
println!("Signature: {:?}", signature);
}
```
#### Verifying a BLS Signature
Here's how you can verify a BLS signature using Rust:
```rust
extern crate epicchain_cryptography_bls12_381_native;
use epicchain_cryptography_bls12_381_native::{BLSSecretKey, BLSPublicKey, BLSSignature};
fn main() {
// Initialize the library
epicchain_cryptography_bls12_381_native::init();
// Generate a secret key and corresponding public key
let sk = BLSSecretKey::generate();
let pk = sk.public_key();
// Message to be signed
let message = b"Hello, EpicChain!";
// Generate a signature
let signature = sk.sign(message);
// Verify the signature
let valid = pk.verify(&signature, message);
if valid {
println!("Signature is valid.");
} else {
println!("Signature is invalid.");
}
}
```
## Contributing
We value contributions from the community and encourage you to participate in the development of `EpicChain.Cryptography.BLS12_381.Native`. To contribute:
1. **Fork the Repository**: Start by creating your own copy of the repository on GitHub.
2. **Create a New Branch**: Develop your feature or bug fix on a separate branch.
3. **Commit Changes**: Make commits with clear and descriptive messages.
4. **Push and Submit**: Push your branch to your fork and submit a pull request with a comprehensive description of your changes.
## License
`EpicChain.Cryptography.BLS12_381.Native` is licensed under the MIT License. For detailed licensing information, please refer to the [LICENSE](LICENSE) file included in the repository.
## Contact Information
For any inquiries or issues regarding `EpicChain.Cryptography.BLS12_381.Native`, please reach out to the EpicChain development team via email at [support@epic-chain.org](mailto:support@epic-chain.org).
By following this guide, you can effectively set up, build, and integrate `EpicChain.Cryptography.BLS12_381.Native` into your projects, ensuring top-tier cryptographic performance and security.