Created
May 5, 2022 07:20
-
-
Save massimilianochiodi/4a5e0f655e8158458b6f8eb63bf73372 to your computer and use it in GitHub Desktop.
Increment Encription Counter Swift ( Little Endian )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public func CtrIncrement() { | |
let key: Data = Data(bytes: &self.EncryptionCounter, count: MemoryLayout<UInt32>.size) // 1215590466 | |
let keyrev: [UInt8] = key.bytes.reversed() | |
var value: Int = byte_to_int(dato: Data(keyrev)) | |
value = value + 1 | |
let keyrevdata: Data = Data(bytes: &value, count: MemoryLayout<UInt32>.size) | |
let keyrevrev: [UInt8] = keyrevdata.bytes.reversed() | |
let valore: Int = byte_to_int(dato: Data(keyrevrev)) | |
self.EncryptionCounter = valore | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment