Solution by GaneshG: Did not understand ALL the code, but managed with some luck.
Hack: If name is single character then key == 0.
.py file takes name and spits out code
Solution by ex0dea: For better color-coding, rename save this to a .c file and open in a text editor. We use ghidra to extract the disassembled code and observe important functions. These are then analysed in the comments until we reach the 'solution' of the problem.