ascon: remove byteorder dependency (#37)

We can use the support in `core` instead
This commit is contained in:
Tony Arcieri 2023-02-25 15:49:52 -07:00 committed by GitHub
parent e4c0b56c7c
commit 6de759ac15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 17 deletions

9
Cargo.lock generated
View File

@ -5,15 +5,6 @@ version = 3
[[package]]
name = "ascon"
version = "0.2.0-pre"
dependencies = [
"byteorder",
]
[[package]]
name = "byteorder"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "cpufeatures"

View File

@ -14,9 +14,6 @@ categories = ["cryptography", "no-std"]
readme = "README.md"
edition = "2018"
[dependencies]
byteorder = { version = "1.0", default-features = false }
[features]
default = ["alloc"]
alloc = []

View File

@ -25,6 +25,7 @@
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg",
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg"
)]
#![forbid(unsafe_code)]
#![warn(
clippy::mod_module_files,
clippy::unwrap_used,

View File

@ -1,17 +1,16 @@
use byteorder::{BigEndian, ByteOrder};
pub type Endian = BigEndian;
use core::convert::TryInto;
#[inline]
#[allow(clippy::unwrap_used)]
pub fn u8_to_u64(input: &[u8], output: &mut [u64]) {
for (i, b) in output.iter_mut().enumerate() {
*b = Endian::read_u64(&input[(i * 8)..((i + 1) * 8)]);
*b = u64::from_be_bytes(input[(i * 8)..((i + 1) * 8)].try_into().unwrap());
}
}
#[inline]
pub fn u64_to_u8(input: &[u64], output: &mut [u8]) {
for (i, &b) in input.iter().enumerate() {
Endian::write_u64(&mut output[(i * 8)..((i + 1) * 8)], b)
output[(i * 8)..((i + 1) * 8)].copy_from_slice(&b.to_be_bytes())
}
}