$m$ square-free integer such that $4\vert m-1\implies 2$ irreducible in $\mathbb{Z}[\sqrt{m}]$ Let $m$ square-free integer such that $4\vert m-1$. I need to prove that
$2$ is irreducible in $\mathbb{Z}[\sqrt{m}]$.

What I taught is to use the following theorem:

LEMMA: Let $R$ a Euclidian domain with respect to $\phi$, and $\alpha=\min\{\phi(a):a\in R(\{0\}\bigcup R^{*})\}$, where $R^{*}$ denote the invertible elements of $R$. So the element $b\in R(\{0\}\bigcup R^{*})$ such that $\phi(b)=a$ is irreducible in $R$.

Well, IF $\mathbb{Z}[\sqrt{m}]$ is a Euclidian domain with respect to $\phi(a+b\sqrt{m})=|a^2-mb^2|$, so I can use the Lemma, since $\alpha=4\implies b=2$ is irreducible in $\mathbb{Z}[\sqrt{m}]$.

I just need to prove that $\mathbb{Z}[\sqrt{m}]$ is a Euclidian domain.

Is easy to see that $\phi$ is multiplicative, but the Euclidian Algorithm part is confuse to me.

Is $\mathbb{Z}[\sqrt{m}] $ actually a Euclidian domain (supposing $m$ square free and $4\vert m-1)?$
If $4\mid m-1$, then $\mathbb{Z}[\sqrt{m}]$ is not integrally closed and so cannot be an Euclidean domain.

Indeed, if $4\mid m-1$, then the integral closure of $\mathbb{Z}[\sqrt{m}]$ is $\mathbb{Z}[\frac{1+\sqrt{m}}{2}]$.
If $4\mid m-1$, then $\mathbb{Z}[\sqrt{m}]$ is not integrally closed and so cannot be an Euclidean domain.

Indeed, if $4\mid m-1$, then the integral closure of $\mathbb{Z}[\sqrt{m}]$ is $\mathbb{Z}[\frac{1+\sqrt{m}}{2}]$.