The cipher is now working. Fixed an additional bug in the multx function, plus the spec's cipher pseudocode literaly translates into an off-by-one error. That was another bug preventing the cipher to work. Now it seems to be fine.