Last active
August 29, 2015 14:06
-
-
Save stephen-hill/60ead6d9594c48156b49 to your computer and use it in GitHub Desktop.
php-rsa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Code ported from http://code.activestate.com/recipes/578838-rsa-a-simple-and-easy-to-read-implementation/ | |
function getPrimes($start, $stop) | |
{ | |
$primes = array(2); | |
$range = range(3, $stop + 1, 2); | |
foreach ($range as $n) { | |
foreach($primes as $p) { | |
if ($n % $p === 0) { | |
break; | |
} | |
} | |
$primes[] = $n; | |
} | |
var_dump($primes); | |
} | |
getPrimes(10, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment