TITLE: Determine $2^{\frac{p-1}{4}}\equiv 1\pmod p$ or $2^{\frac{p-1}{4}}\equiv -1\pmod p$ when $p\equiv 1 \pmod 8$
QUESTION [5 upvotes]: 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!

REPLY [3 votes]: OEIS/A014754 seems to be the primes $p \equiv 1 \bmod 8$ such that $2^{\frac{p-1}{4}}\equiv 1 \bmod p$.
These are the primes such that $\pm 2$ is a fourth power mod $p$.
Also the primes of the form $x^2+64y^2$.
Not much more is known about these primes.