Switch from subtle-encoding to base16ct (#443)

This commit is contained in:
Tony Arcieri (iqlusion)
2022-11-14 15:26:07 -07:00
committed by GitHub
parent 5c4259023f
commit 0a2e798894
6 changed files with 25 additions and 31 deletions
+10 -8
View File
@@ -32,11 +32,7 @@
use crate::{Error, Result, YubiKey};
use rand_core::{OsRng, RngCore};
use std::{
fmt::{self, Debug, Display},
str,
};
use subtle_encoding::hex;
use std::fmt::{self, Debug, Display};
/// CCCID offset
const CCC_ID_OFFS: usize = 9;
@@ -114,8 +110,14 @@ impl CccId {
}
}
impl Display for CccId {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(str::from_utf8(&hex::encode(&self.0[..])).unwrap())
impl AsRef<[u8]> for CccId {
fn as_ref(&self) -> &[u8] {
&self.0
}
}
impl Display for CccId {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(&hex::upper::encode_string(self.as_ref()))
}
}