From 67a7b9b0ee781d8d1d1c8b0400afd7e263d15d5d Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Sat, 31 Jul 2021 11:47:37 -0400 Subject: [PATCH] use to_be_bytes for build_time_bytes --- src/lib.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 58c5850..103c316 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,13 +46,8 @@ pub struct SteamGuardAccount { pub session: Option, } -fn build_time_bytes(mut time: i64) -> [u8; 8] { - let mut bytes: [u8; 8] = [0; 8]; - for i in (0..8).rev() { - bytes[i] = time as u8; - time >>= 8; - } - return bytes +fn build_time_bytes(time: i64) -> [u8; 8] { + return time.to_be_bytes(); } pub fn parse_shared_secret(secret: String) -> anyhow::Result<[u8; 20]> {