mirror of
https://github.com/logos-blockchain/sponges.git
synced 2026-07-30 02:23:31 +00:00
ascon: remove byteorder dependency (#37)
We can use the support in `core` instead
This commit is contained in:
parent
e4c0b56c7c
commit
6de759ac15
9
Cargo.lock
generated
9
Cargo.lock
generated
@ -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"
|
||||
|
||||
@ -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 = []
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user