Das Beispiel in der Hilfe sollte im ASCII-Modus funktionieren.
Hier mal eine überarbeitete Version für ASCII- und Unicode Modus:
Code: Alles auswählen
EnableExplicit
Define String$ = "Hello this is a test for AES"
Define *CipheredString = AllocateMemory(StringByteLength(String$) + SizeOf(Character)) ; Platz für den null-terminierten String
Define *DecipheredString = AllocateMemory(StringByteLength(String$) + SizeOf(Character)) ; mit seiner abschließenden Null
If AESEncoder(@String$, *CipheredString, MemorySize(*CipheredString), ?Key, 128, ?InitializationVector)
Debug "Ciphered: " + PeekS(*CipheredString)
AESDecoder(*CipheredString, *DecipheredString, MemorySize(*DecipheredString), ?Key, 128, ?InitializationVector)
Debug "Deciphered: " + PeekS(*DecipheredString)
EndIf
DataSection
Key:
Data.b $06, $a9, $21, $40, $36, $b8, $a1, $5b, $51, $2e, $03, $d5, $34, $12, $00, $06
InitializationVector:
Data.b $3d, $af, $ba, $42, $9d, $9e, $b4, $30, $b4, $22, $da, $80, $2c, $9f, $ac, $41
EndDataSection