Get back to basics, with some basic tests working.

This commit is contained in:
2019-07-30 16:23:14 -07:00
parent 203c23e277
commit 1d8907539d
10 changed files with 384 additions and 173 deletions

View File

@@ -1,6 +1,8 @@
#![no_std]
#![cfg_attr(not(test),no_std)]
pub mod signed;
pub mod unsigned;
#[cfg(test)]
mod testing;
/// A trait definition for large numbers.
pub trait CryptoNum {
@@ -25,7 +27,7 @@ pub trait CryptoNum {
/// this will assume that the number is in the first `n` bits of the
/// memory layout. If you pass in a smaller buffer, it will use the bits
/// available as the low `n` bits of the number.
fn from_bytes(&self, bytes: &[u8]) -> Self;
fn from_bytes(bytes: &[u8]) -> Self;
/// Write the cryptonum into the provide slice. If the provided slice
/// is greater than or equal to `n` bits in length, `to_bytes` will
/// write to the first `n` bits. If the slice is less than `n` bits