compiler options

Just starting out? Need help? Post your questions and find answers here.
Davy
User
User
Posts: 45
Joined: Wed Jun 13, 2012 7:43 pm

compiler options

Post 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.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: compiler options

Post 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
I may look like a mule, but I'm not a complete ass.
Post Reply