# How to label sides of a square and its diagonal

I have made a square and have a diagonal along the middle. I want to label the bottom side, right side, and the diagonal to show the Pythagorean identity. So the sides should be, 1,1, and square root respectively. How would I add this in the code?

\begin{tikzpicture}
\draw (0,0) -- (4,0) -- (4,4) -- (0,4) -- (0,0) ;
\draw (0,0) -- (4,4);
\end{tikzpicture}


\begin{tikzpicture}
\draw (0,0) -- node[left, pos=.5, sloped, above]{$\sqrt{2}$}(4,4);