RC4 for WX
WinDev, WebDev and WinDev Mobile consulting

COL_RC4_WX is a collection of procedures developed in collaboration by Michel Garcia, our resident expert in all thing cryptographic and Fabrice Harari
VERSION 1.0a - June 06, 2014

COL_RC4_WX is OPEN SOURCE. It doesn't use any specific license, but you can use it in any project, commercial or not, without having to pay any fee... 

you can improve it, branch it, modify it, or do whatever you want with it.
It's latest version will always be available on fabriceharari.com


Purpose: solve the problem of encoding in one environment (Android, WinDev, or WebDev) and decoding in another. As there is currently still NO options of the crypt/uncrypt functions available in android that is compatible with the options available for WinDev and WebDev. With this collection of procedure, you can encrypt a buffer, an ANSI string or a UNICODE string in WinDev, send it to an Android application and decode it there (or the contrary)

 The only constraint is for you to know which type of data was encrypted in the beginning, so as to set it in a variable of the same type when decrypting:
 if you encrypt a buffer, you need to get the decryption result in a buffer variable, if you encrypt an ANSI string, you need to get the decryption result in an ANSI string...

This code is provided AS IS, without any warranty... We tested it and found no problem with it, but that doesn't mean that there wont be one in the future. 
 As you have access to the source, you are supposed to be able to debug it in case of a malfunction. If you are not able to do so, both Michel Garcia and Fabrice Harari are available to assist you in the form of a billable consulting work.

This procedure uses an implementation of the RC4 algorithm. You can read more about it here: http://en.wikipedia.org/wiki/RC4

If you want more advanced/secure algorithms, Michel Garcia is offering a whole bunch of them as components here: http://www.iim.ch
For more information about them, you can also contact him by email: info@iim.ch

This collection of procedure has been tested in WinDev Mobile Android (simulator/emulator/hardware) 19, WinDev 19 and WebDev server 19. Encryption and Decryption are compatible between all of these platforms. This code MAY or MAY NOT work on other platform or versions, as the list of functions available depends on the platform and version

Please report any  bug you could find or any  improvement you added to Fabrice Harari using this email: support@fabriceharari.com

1. include the collection of procedures in your project
2. call the RC4CryptDecrypt to crypt OR decrypt a buffer, an ANSI string or a UNICODE string. The same function is used for encryption and decryption because the function is completely symmetrical.
3. If you have to call the RC4CryptDecrypt function a lot of time in your code, you may want to call ONCE the SetKey procedure to set the encryption key for all further calls, then call the RC4CryptDecrypt WITHOUT specifying a key. You can also change the DEFAULT (gcsKey) key value in the collection of procedures init code area.


That's all...ENJOY