Let $p=8k+1\equiv 1\pmod 8$ be a prime, thus $2$ is a quadratic residue module $p$. Euler's criterion show that $$2^{\frac{p-1}{2}}\equiv 1 \pmod p.$$

So we must have $$2^{\frac{p-1}{4}}\equiv \delta(p) \pmod p$$ where $\delta(p)=\pm1$.

**Now my question is how to determine $\delta(p)$.**

I calculated many examples. Statistics show that the value of $\delta(p)$ should be related with the parity of $k$ and $h(-p)$, the latter being the class number of $\mathbb{Q}(\sqrt{-p})$. I know little algebraic number theory and hope some experts could help me solve this problem. I am waiting for help, thank you very much!

**EDIT**

Now I have formulated my conjecture about $\delta(p)$, which states as follows.

**Conjecture:**

$$\delta (p)=(-1)^{\frac{h(-p)}{4}+k}$$

Any ideas to prove or counterexample to disprove this?