{"id":6005,"date":"2017-04-12T09:08:48","date_gmt":"2017-04-12T14:08:48","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=6005"},"modified":"2017-04-12T14:16:56","modified_gmt":"2017-04-12T19:16:56","slug":"finding-large-prime-numbers-with-python","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2017\/04\/12\/finding-large-prime-numbers-with-python\/","title":{"rendered":"Finding large prime numbers with python"},"content":{"rendered":"<p>This post will provide how to calculate the largest prime number of a 96 bit number. This was chosen as a starting point.  As you can see, it took almost 27 minutes (1614 seconds) to calculate on a dual core laptop.<\/p>\n<pre>\r\n>>> import random\r\n>>> random.getrandbits(64)\r\n5586838809177767755L\r\n>>> def calcPrime(n):\r\n...   i = 2\r\n...   while i * i <= n:\r\n...     if n % i:\r\n...       i += 1\r\n...     else:\r\n...       n \/\/= i\r\n...   return n\r\n...\r\n>>> calcPrime(random.getrandbits(64))\r\n17132851387L\r\n>>> calcPrime(random.getrandbits(70))\r\n29976485827L\r\n>>> calcPrime(random.getrandbits(80))\r\n83358363197L\r\n>>> import time\r\n>>> t0 = time.time()\r\n>>> calcPrime(random.getrandbits(96))\r\n>>> t1 = time.time()\r\n>>> print t1-t0\r\n1614.5999999\r\n>>>\r\n<\/pre>\n<p>A security algorithm such as RSA uses the largest prime factors of a composite number.  As such, you would have to calculate each number for a number much higher than can be stored in 96 bits (roughly 79 octillion);  in 2016, 2048 bit encryption is standard.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post will provide how to calculate the largest prime number of a 96 bit number. This was chosen as a starting point. As you can see, it took almost 27 minutes (1614 seconds) to calculate on a dual core&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2017\/04\/12\/finding-large-prime-numbers-with-python\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[8,66],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/6005"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=6005"}],"version-history":[{"count":7,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/6005\/revisions"}],"predecessor-version":[{"id":6237,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/6005\/revisions\/6237"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=6005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=6005"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=6005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}