# Do we always use Sophie-Germain primes $1\bmod 4$?

A prime $p$ is Sophie Germain if $2p+1$ is also prime. Wiki says if $p\equiv3\bmod4$ then $2p+1|2^p-1$. This seems to put a huge restriction on density of Sophie-Germain prime if they are $3\bmod4$. For this reason do all systems use Sophie-Germain primes with $1\bmod 4$ for discrete logarithm?

This seems to put a huge restriction on density of Sophie-Germain prime if they are $3 \bmod 4$.

I'm not sure how you come to that conclusion; whether $2p+1$ is a factor of $2^p-1$ would not have any immediately obvious consequence to $2p+1$ being prime.

For this reason do all systems use Sophie-Germain primes with $1 \bmod 4$ for discrete logarithm?

Actually, Sophie-Germain primes of the form $3 \bmod 4$ would appear to be more prevalent; for example, the primes listed here are all of the form $3 \bmod 4$. One reason is that it makes the value $g=2$ be a quadratic residue, that is, its use during the DH operation doesn't leak the lsbit of the private exponent, and that's appreciated by some people.

• could you explain on 'its use during the DH operation doesn't leak the lsbit of the private exponent'? I though lsbit is always leaked no matter what.
– Mr.
May 14 '17 at 21:45
• @Turbo: sure; in DH, Alice picks a random value $a$ and transmites $g^a \bmod p$; if $g$ is a primitive element, anyone can test if $g^a$ is a quadratic residue; if it is, then the lsbit of $a$ is a 0; otherwise it is a 1. If $g$ is a quadratic residue, then that test tells people nothing (as $g^a \bmod p$ is always a quadratic residue). May 14 '17 at 21:47
• so $1\bmod 4$ and $3\bmod 4$ Sophie-Germain prime densities are believed similar?
– Mr.
May 14 '17 at 21:49
• @Turbo: as far as I know; a quick count of the ones under 100,000,000 shows a slight edge to the $3 \bmod 4$ (211,439 vs 211,700)... May 15 '17 at 2:53
• 3 mod 4 has a very small lead at 1e9 and 1e10 as well, but loses it by 2e10 (20,000,000,000). It's extremely close at 1e11 with 3 mod 4 leading by a very small amount. May 15 '17 at 19:44
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7452996969223022, "perplexity": 827.1861127129496}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-43/segments/1634323585242.44/warc/CC-MAIN-20211019043325-20211019073325-00126.warc.gz"}