mirror of
https://gitea.tendokyu.moe/ppc/amnet.git
synced 2026-10-11 00:48:09 +03:00
complete base rewrite
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
pub (in crate) fn format_hex_bytes(bytes: &[u8]) -> String {
|
||||
pub (crate) fn format_hex_bytes(bytes: &[u8]) -> String {
|
||||
bytes.chunks(2)
|
||||
.map(|chunk| chunk.iter().map(|b| format!("{:02X}", b)).collect::<String>())
|
||||
.collect::<Vec<_>>()
|
||||
.join(" ")
|
||||
}
|
||||
|
||||
pub (in crate) fn parse_access_code(code: &String) -> Option<[u8; 10]> {
|
||||
pub (crate) fn parse_access_code(code: &String) -> Option<[u8; 10]> {
|
||||
let matrix_code = format!("{:0>20}", code.replace(" ", ""));
|
||||
let mut bytes: [u8; 10] = [0; 10];
|
||||
|
||||
@@ -19,7 +19,7 @@ pub (in crate) fn parse_access_code(code: &String) -> Option<[u8; 10]> {
|
||||
Some(bytes)
|
||||
}
|
||||
|
||||
pub (in crate) fn parse_idm_hex(idm_hex: &String) -> Option<[u8; 8]> {
|
||||
pub (crate) fn parse_idm_hex(idm_hex: &String) -> Option<[u8; 8]> {
|
||||
if idm_hex.len() > 16 || !idm_hex.chars().all(|c| c.is_ascii_hexdigit()) {
|
||||
return None;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user