| Crates.io | avila-primitives |
| lib.rs | avila-primitives |
| version | 0.1.0 |
| created_at | 2025-12-08 18:32:21.839393+00 |
| updated_at | 2025-12-08 18:32:21.839393+00 |
| description | Big integer primitives (U256, U512, U1024, U2048, U4096) - Built on avila-nucleus |
| homepage | https://avila.inc |
| repository | https://github.com/avilaops/arxis |
| max_upload_size | |
| id | 1974188 |
| size | 207,367 |
Primitive types and core abstractions for the Avila ecosystem.
U64, U128 - Type aliases for consistencyU256 - 256-bit integer (4 × u64 limbs)U512 - 512-bit integer (8 × u64 limbs)U1024, U2048, U4096 - Larger types (array of limbs)Bytes32 - 32-byte array (256 bits)Bytes64 - 64-byte array (512 bits)BitOps - Bit manipulationCountBits - Type metadataFromBytes / ToBytes - ConversionsByteArray - Byte array operationsuse avila_primitives::prelude::*;
// Create U256 from u64
let a = U256::from_u64(42);
let b = U256::from_u64(8);
// Arithmetic
let sum = a + b;
assert_eq!(sum.to_u64(), 50);
// Checked operations
let overflow = U256::MAX.checked_add(&U256::ONE);
assert!(overflow.is_none());
use avila_primitives::{Bytes32, ByteArray};
let mut data = Bytes32::ZERO;
data.0[0] = 0xFF;
// Zeroize (security)
data.zeroize();
assert_eq!(data.0, [0u8; 32]);
use avila_primitives::bits::{ct_select_u64, ct_eq_u64};
// Constant-time selection (no branches)
let secret = ct_select_u64(condition, value_a, value_b);
// Constant-time comparison
assert!(ct_eq_u64(secret, expected));
Add to your Cargo.toml:
[dependencies]
avila-primitives = "0.1.0"
For no_std environments:
[dependencies]
avila-primitives = { version = "0.1.0", default-features = false }
Licensed under either of:
at your option.
Contributions are welcome! Please see CONTRIBUTING.md.