Page 1 of 1
					
				compiler options
				Posted: Thu Aug 09, 2012 1:23 pm
				by Davy
				When using the AESEncoder, the manual says to compile in ascii mode. Since I can't find any such option in the compiler options I assume this is the default and if I don't want ascii I would check the "create Unicode executable" box? 
Thanks.
			 
			
					
				Re: compiler options
				Posted: Thu Aug 09, 2012 1:29 pm
				by srod
				Yes that is correct.
Incidentally, you can use AES with Unicode if you make use of buffers.
Code: Select all
  String$ = "Hello this is a test for AES"
  
  *CipheredString   = AllocateMemory(Len(String$)<<(SizeOf(CHARACTER)-1)+1) ; Space for the string and its
  *DecipheredString = AllocateMemory(Len(String$)<<(SizeOf(CHARACTER)-1)+1) ; null terminating character
  
  If AESEncoder(@String$, *CipheredString, Len(String$)<<(SizeOf(CHARACTER)-1), ?Key, 128, 0, #PB_Cipher_ECB)
    Debug "Ciphered: "+PeekS(*CipheredString)
    
    AESDecoder(*CipheredString, *DecipheredString, Len(String$)<<(SizeOf(CHARACTER)-1), ?Key, 128, 0, #PB_Cipher_ECB)
    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
  EndDataSection