7. Given that $A B C-A_{1} B_{1} C_{1}$ is a right triangular prism, $\angle B A C=90^{\circ}$, points $D_{1}, F_{1}$ are the midpoints of $A_{1} B_{1}, B_{1} C_{1}$ respectively. If $A B=C A=A A_{1}$, find the cosine of the angle between $B D_{1}$ and $C F_{1}$.
7. Complete the given right triangular prism into a cube $A B P C-A_{1} B_{1} P_{1} C_{1}$. Take the midpoints $E, H$ of $B P, C F_{1}$ respectively, and connect $E F_{1}, C E$, $E H$. Then $B D_{1} / / E F$, so $\angle E F_{1} H$ is the angle formed by $B D_{1}$ and $C F_{1}$. Let the edge length of the cube be 2, then $E F_{1}=B D_{1}=\sqrt{5}, F_{1} H=$ $\frac{1}{2} \sqrt{C_{1} C^{2}+C_{1} F_{1}^{2}}=\frac{\sqrt{6}}{2}$, and $E H \perp C F_{1}$, hence $\cos \angle E F_{1} H=\frac{F_{1} H}{E F_{1}}=\frac{\sqrt{30}}{10}$ is the desired result.