In examples (http://www.example-code.com/foxpro/crypt2_arc4.asp) there is example for ARC4 encryption:
and this code works perfectly. But when I change encoding type from "hex" to "ascii"
then EncryptStringENC method does not return all characters (it should be the same number as in encrypted text). It is evident that characters with ASCII value higher than 127 are deleted.
Also DecryptStringENC does not accept encrypted char string that contains binary chars (chars with ASCII > 127).
Is this by design or is this a bug? How I can get binary coded string with encoded text? And how I can put binary string with encoded text to DecryptStringENC method? Normally ARC4 encryption is symmetrical and providing this code
should return the original "Text to encrypt" string.
The only method I have found is recode string to hexa, use "hex" EncodingMode, use "hex" CharSet and encode again from hexa to char string. So my universal (encoding and/or decoding) function looks like:
But this looks little bit complicated.
Thanks for your help.
asked Apr 16 at 17:25
It looks the original question was too complicated as nobody answered it yet.
So short clear question: Should the ASCII encoding (EncodingMode="ascii") return characters from the whole (extended ASCII) range (chars with ASCII codes 0 to 255) or only characters from the pure US ASCII (chars with ASCII codes from 0 to 127)?
answered Apr 21 at 01:15