Commit Graph

39 Commits

Author SHA1 Message Date
joerg cbd2e3d54f Properly print string. 2011-05-23 22:49:59 +00:00
joerg 6394298f1b Follow the Fundamental Theory of Algebra. Disallow factorising of
numbers less than 2 as it is not
- naturally unique (negative numbers)
- finite (0)
- non-empty (1)

Discussed with the kristaps and wiz
2010-05-15 21:22:39 +00:00
tnozaki 50eb6aadde cast isblank(3)'s argument to unsigned char. 2010-05-13 17:52:11 +00:00
drochner d184555b35 rename pollard_pminus1->pollard_rho for consistency 2010-04-28 18:04:31 +00:00
drochner fe64100e9e -Fix an old bug in the "pollard" code: it gets its argument passed
by reference, and changes the value behind the pointer under some
 circumstances (basically if it finds more than 2 different factors).
 It also calls itself if it finds a factor which is not considered prime
 (by openssl's miller-rabin check) and uses the call argument afterwards.
 This doesn't work -- we need to copy the argument into its own storage.
-Modify the code to do the "rho" algorithm as was initially announced.
 It takes somewhat longer in rare cases, but still works in cases where
 the "p-1" algorithm is unusable. This might fix PR misc/43192
 by Luiz Henrique de Figueiredo.
-Add some optional debug support, minor cleanup.
2010-04-27 18:11:19 +00:00
drochner f79e06d729 fix an obvious flaw in bounds check: the array of precomputed primes
could be overrun if its last entry (65537) was a factor of the input
(this does not affect PR misc/43192 -- the factors are much larger
here: 7742394596501*159455563099482401)
2010-04-22 14:28:48 +00:00
wiz 0b27f753a1 Add backslash before a dash to get a minus. 2010-04-22 06:57:13 +00:00
dholland 9f8746b55e Sync with reality. Bump date. 2010-04-22 04:42:21 +00:00
dholland e0ba63fe83 sprinkle static 2009-08-12 05:48:04 +00:00
lukem 2fe2731d3f Remove the \n and tabs from the __COPYRIGHT() strings. 2008-07-20 00:52:39 +00:00
perry 8b0f9554ff convert __attribute__s to applicable cdefs.h macros 2007-12-15 19:44:37 +00:00
rillig 1a815e1f74 Fixed a comment that said the factors in the output would be strictly
ascending.
2005-06-27 20:49:31 +00:00
christos ceb0805a9b Add -lcrypt where -lcrypto is specified. 2005-03-09 03:11:21 +00:00
jsm 4eccb08bd5 Separate primes manpage from that of factor. Correct DIAGNOSTICS
information.
2004-02-08 13:16:25 +00:00
jsm 4eec310a4f Check large factor for being prime before applying Pollard's
algorithm; fixes "factor 2147483647111311".  Correct comment;
algorithm is Pollard p-1, not Pollard rho.  Increase base if p-1
algorithm reaches 1; fixes "factor 99999999999991".  Testcases from
David A Bagley <bagleyd@tux.org>.
2004-02-08 11:47:36 +00:00
agc e5aeb4ea46 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22269, verified by myself.
2003-08-07 09:36:50 +00:00
wiz c91d8d6b9b Lots of minor fixes resulting from reading these man pages in detail. 2002-09-26 18:31:58 +00:00
lukem 0be7b964d2 use NETBSDSRCDIR as appropriate 2002-09-19 03:15:39 +00:00
simonb aab04f503e Provide a BN_dec2bn() shim for the non-openssl case that reports an error
if strtoul() fails.
2002-06-18 23:07:36 +00:00
simonb da942834bb Fix a logic botch where if a number smaller than the square of the seive
was prime to still called the Pollard Rho function when it didn't have
to.  Problem report by Nathan Williams.

Unfortunately this one can't be picked up by a simple regression test
since the broken way still produced the correct output, but just took
far longer...
2002-06-17 15:43:52 +00:00
itojun 69757aee7e make factor work with and without openssl. 2002-06-16 22:24:00 +00:00
simonb a311a7732d Use libcrypto's bignum support to implement a Pollard Rho factoring
algorithm so we can factorise numbers larger than a host long.
2002-06-15 02:12:23 +00:00
wiz 834bb1b3ab Whitespace and/or punctuation fixes. 2001-04-02 22:42:37 +00:00
jsm 092d313019 Add use of `const' where appropriate to the games.
This merges in all such remaining changes from the Linux port of the
NetBSD games, except in hunt (where substantial changes from OpenBSD
need to be looked at).

Some such changes were previously covered in PRs bin/6041, bin/6146,
bin/6148, bin/6150, bin/6151, bin/6580, bin/6660, bin/7993, bin/7994,
bin/8039, bin/8057 and bin/8093.
1999-09-08 21:17:44 +00:00
hubertf 1c9494f62b mark non-returning functions (PR#6144 by Joseph Myers <jsm28@cam.ac.uk>) 1998-09-13 15:27:25 +00:00
lukem dd1343dba9 use CPPFLAGS instead of CFLAGS 1997-10-22 04:42:45 +00:00
lukem 82090a8bf1 WARNSify 1997-10-10 12:49:45 +00:00
gwr 10e180cc49 Back out the .PATH.c changes. The .depend problem (and others)
will be fixed using the new .NOPATH make feature instead.
1997-05-08 21:11:01 +00:00
gwr 012e528f2e Use .PATH.c: ... 1997-05-06 20:44:56 +00:00
tls 34cd8f5bdf Sync to 4.4BSD-Lite2 1997-01-07 11:56:32 +00:00
cgd 42fb1b9d4a merge with Lite, new RCS id conventions, etc. 1995-03-23 08:28:00 +00:00
cgd c4c01d75b2 specify man pages the new way. 1994-12-22 09:31:26 +00:00
deraadt db651dca40 bring in limits.h 1994-03-03 03:07:24 +00:00
mycroft bcda10fca5 Eliminate a compiler warning. 1993-12-08 07:27:50 +00:00
jtc defa0d9f09 Update to use new -mandoc macros. 1993-08-05 01:46:15 +00:00
mycroft 8542364e07 Add RCS identifiers. 1993-08-01 18:49:50 +00:00
mycroft b1bd4afedc Add RCS indentifiers. 1993-08-01 07:42:49 +00:00
mycroft cda4f8f6ee Add RCS identifiers. 1993-08-01 05:37:30 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00