mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-07-22 09:15:15 +08:00
feat: implement production cas v1
This commit is contained in:
@@ -29,14 +29,11 @@ impl Hash {
|
||||
|
||||
/// 从十六进制字符串解析
|
||||
pub fn from_hex(s: &str) -> Result<Self, crate::error::CasError> {
|
||||
let bytes = hex::decode(s).map_err(|_| {
|
||||
crate::error::CasError::Other(anyhow::anyhow!("Invalid hex string"))
|
||||
})?;
|
||||
let bytes =
|
||||
hex::decode(s).map_err(|_| crate::error::CasError::InvalidHash(s.to_string()))?;
|
||||
|
||||
if bytes.len() != 32 {
|
||||
return Err(crate::error::CasError::Other(anyhow::anyhow!(
|
||||
"Hash must be 32 bytes"
|
||||
)));
|
||||
return Err(crate::error::CasError::InvalidHash(s.to_string()));
|
||||
}
|
||||
|
||||
let mut hash_bytes = [0u8; 32];
|
||||
|
||||
Reference in New Issue
Block a user