You can write AnsiChar(SomeOrdinalValue)
to make an AnsiChar
with a specific ordinal. So your code should be:
AStr := AnsiChar(hchar);
The problem with the code in the question is that you converted to UTF-16 and back.
It would seem to me that strings are the wrong type for your crypto code. Use a byte array, TBytes
.