I recently had a variant of the following problem in my cryptography course and I had trouble solving it and was looking to get some help.
Given the symmetric key cryptosystem: $\text{KG, Enc, Dec}$ where $\text{KG}$ is a key generator that produces a random key in the space $Z_n = \{1, 2, 3, \ldots, n-1\}$, $m$ is a message from the space $Z_n$, and $\text{Enc}(K, m)$ is an encryption algorithm which computes ciphertext $c = (5m - 4k + 3) \bmod n$, design a decryption algorithm $\text{Dec}(K, c)$ such that it fulfills decryption correctness.
At first, I just tried solving for $c$ in $c = 5m - 4k + 3$, but realized that it does not account for $\bmod n$. Then it tried the following solution:
$$ \text{let} (d, x, y) = \text{extGCD}(c, n), m = (c\times x+4k-3)/5 $$
Where $\text{extGCD}$ is the Euclidian extended GCD function (essentially finding the modular inverse). That did not work either.
How would one go about solving this problem? What am I missing (so I can look into it further)?