mirror of
https://github.com/uutils/num-prime.git
synced 2026-06-10 16:12:35 -07:00
Update license
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "num-prime"
|
||||
version = "0.0.1"
|
||||
version = "0.0.2"
|
||||
edition = "2018"
|
||||
|
||||
repository = "https://github.com/cmpute/num-prime"
|
||||
|
||||
@@ -186,7 +186,7 @@ APPENDIX: How to apply the Apache License to your work.
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
Copyright [2021] [Jacob Zhong]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
+2
-4
@@ -3,7 +3,7 @@
|
||||
use std::collections::{HashMap};
|
||||
use bitvec::prelude::bitvec;
|
||||
use num_traits::{ToPrimitive, One, Pow};
|
||||
use num_bigint::BigUint;
|
||||
use num_bigint::BigUint; // TODO: make the dependency for this optional
|
||||
use num_integer::Integer;
|
||||
use rand::{random, seq::IteratorRandom};
|
||||
use crate::traits::Arithmetic;
|
||||
@@ -225,9 +225,7 @@ impl PrimeBuffer { // TODO: support indexing and iterating
|
||||
pub fn bdivisor(&mut self, target: &BigUint, trials: Option<i32>) -> Option<BigUint> {
|
||||
// if the target is in u64 range
|
||||
if let Some(x) = target.to_u64() {
|
||||
return match self.divisor(x) {
|
||||
Some(d) => Some(BigUint::from(d)), None => None
|
||||
};
|
||||
return self.divisor(x).map(BigUint::from);
|
||||
}
|
||||
|
||||
let primality = self.is_bprime(target, None);
|
||||
|
||||
+2
-3
@@ -29,9 +29,8 @@ pub trait Arithmetic : Integer + NumOps {
|
||||
fn pollard_rho(&self, offset: Self, trials: u32) -> Option<Self>;
|
||||
}
|
||||
|
||||
impl<T> Arithmetic for T
|
||||
where T: Integer + ArithmeticHelpers + FromPrimitive + NumRef + SampleUniform + Clone,
|
||||
for<'r> &'r T: RefNum<T> + std::ops::Shr<usize, Output = T> + ModInt<&'r T, &'r T, Output = T>
|
||||
impl<T: Integer + ArithmeticHelpers + FromPrimitive + NumRef + SampleUniform + Clone> Arithmetic for T
|
||||
where for<'r> &'r T: RefNum<T> + std::ops::Shr<usize, Output = T> + ModInt<&'r T, &'r T, Output = T>
|
||||
{
|
||||
fn is_sprp(&self, witness: T) -> bool {
|
||||
// find 2^shift*u + 1 = n
|
||||
|
||||
Reference in New Issue
Block a user