How would I solve the following congruence? $5x \equiv 118 (\mod 127)$
This is what I have done so far:
$127 = 25*5+2$
$2 = 127-25*5$
$25 = 12*2+1$
$1 = 25-12*2$
$1 = 25-12(127-25*5)$
I am a little stuck on how to continue.
I know I am supposed to write it in a form such that $5v+127w = 1$ but I am not exactly sure how I would do that.
Any help?

To solve it as a naive, start from your second line of solution:
$$127-25 \times5=2 \tag{1}$$ Now$$118/2=59$$
Multiply (1) by 59:-
$$59\times 127-5\times 1475=118$$
All the solutions will be of the form $$x=59+\frac{1475k}{1}\tag{2.}$$and
$$y=-1475+\frac{59k}{1} \tag{3.}$$for $127x+5y=118$.

Or you can adopt extended euclidean algorithm to solve as shown in other answers.
