The Progress 4GL ENCODE Function takes a character string as input and returns a 16 character long encoded string.
Although the same source character string always yields a unique result the reverse is not true. That is the action of the Progress 4GL ENCODE function is not reversible and there is no 4GL function that would return the original source string by acting upon its encrypted value.
The Progress 4GL ENCODE function uses a CRC-16 algorithm to generate its encoded output. This calculation involves a mathematical computational process that applies a polynomial value on the string.
The ENCODE function works on the byte values of the character string. The same character string in a different codepage can have different byte values, so the result of ENCODE will be different in that case.
The Progress 4GL ENCODE function operates on strings containing single as well as double-byte characters; of any length subject to Progress 4GL variable size limitations; and performs a one-way encoding operation that is irreversible.
If cStringA = cStringB then ENCODE(cStringA) = ENCODE(cStringB).
If ENCODE(cStringA) = ENCODE(cStringB) then cStringA may or may not be equal to cStringB.
In other words it is not possible to determine the original string from the result returned by the Progress 4GL ENCODE function.
Note that while cStringA eq cStringB is case-insensitive, and so e.g. "test" eq "Test" will evaluate to True, the returned encoded strings will be different.