encloak/decloak question

Started by nubie on 14-Apr-2020/20:35:55-7:00
I am playing with encloak and decloak using REBOL/View 2.7.8.3.1 1-Jan-2011 this seems to be a weird behaviour. >> m: encloak "1234567890" "abcd" == {°¡^P^_ÿýÚ^\pˆ} >> n: decloak m "abcd" == "1234567890" >> n: decloak m "abcd" == "— ƒ<Ô7^QñTÁ" >> n: decloak m "abcd" == "^D”!„=×6^!ð]" >> trying to understand why is decloak returning a different value every time it is run. I was expecting it to give me the same result every time. i.e "1234567890" but it is not.
"HELP decloak" will show you that the first argument is modified, that is to say, decloak operates in-place. In fact after each of your n: operations n and m will be the same.
Just to expand om Mark's explanation. The simple fix is to throw in a COPY: >> m: encloak "1234567890" "abcd" == {°¡^P^_ÿýÚ^\pˆ} >> n: decloak copy m "abcd" == "1234567890" >> n: decloak copy m "abcd" == "1234567890" >> n: decloak copy m "abcd" == "1234567890"
thanks Mark and Sunanda for your explanations :)

Reply