If the OP wants to secure the communication against replay attacks, just add a timestamp (or a counter) to the packet, and then add salted hash of the packet. But what he asked for sounded like OTP is the answer.
Thanks for this code, it works well.
Indeed, I want to secure communication with this code so the receiver can decode it (but It must change on every time I send data )
the code sent must change say every 10s MAX ( since the application is in local area).
@Thaddy
I'll try to play with it & see, thanks.
Anyway, the function I want, must calculate code in client side, then send data with this code, when the server application intercept, It do the same calculos with the same function and compare it with the code sent from the client. If it equals then OK.
Any other suggestion is welcom.
Thanks