]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/crypto/rsa/rsa.factor
Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places...
[factor.git] / extra / crypto / rsa / rsa.factor
index 1da170d19787ef88e774989fb21cefcadec27ffa..917e98a6ee52cc7f251e7abf19a99ee737de90e4 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: math.primes.miller-rabin kernel math math.functions
-namespaces sequences accessors ;
+USING: math.primes kernel math math.functions namespaces
+sequences accessors ;
 IN: crypto.rsa
 
 ! The private key is the only secret.
@@ -21,12 +21,12 @@ C: <rsa> rsa
 CONSTANT: public-key 65537
 
 : rsa-primes ( numbits -- p q )
-    2/ 2 unique-primes first2 ;
+    2/ 2 swap unique-primes first2 ;
 
 : modulus-phi ( numbits -- n phi ) 
     #! Loop until phi is not divisible by the public key.
     dup rsa-primes [ * ] 2keep
-    [ 1- ] bi@ *
+    [ 1 - ] bi@ *
     dup public-key gcd nip 1 = [
         rot drop
     ] [