3. Given that $E$ is a point on the extension of side $BC$ of square $ABCD$, and a square $AEFG$ is constructed with $AE$ as one side, such that points $A$ and $G$ are on the same side of $BE$. The extension of $BD$ intersects $AF$ at point $H$, with $HD=\sqrt{2}$ and $FH=5\sqrt{2}$. Then the length of $BE$ is $\qquad$
3. 8 .

As shown in Figure 5, draw $F M \perp B E$ at point $M$, intersecting the extension of $B D$ at point $N$, and connect $A C$, intersecting $B D$ at point $O$.

It is easy to prove that Rt $\triangle A B E \cong \mathrm{Rt} \triangle E M F$, and $\triangle B M N$ is an isosceles right triangle.
Thus, $A B=E M, B E=F M, B M=M N$
$\Rightarrow F N=E M=A B$.
Also, $A B / / F N$, hence,
$$
A H=F H=5 \sqrt{2} \Rightarrow A F=10 \sqrt{2} \Rightarrow A E=10 \text {. }
$$

In Rt $\triangle A O H$, by the Pythagorean theorem,
$$
\begin{array}{l}
A O^{2}+(O A+\sqrt{2})^{2}=(5 \sqrt{2})^{2} \\
\Rightarrow O A=3 \sqrt{2} \Rightarrow A B=6 .
\end{array}
$$

In Rt $\triangle A B E$, by the Pythagorean theorem, $B E=8$.