commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
a37917ab50f50fc30387c64b48b67d485c092810 | Patrick D Hayes | 2019-03-19T15:08:26 | feat(key): add `to_public_key` method for RSAPrivateKey
Adds the `to_public_key` method for RSAPrivateKey, as a utility for when we need a concrete RSAPublicKey instead of a trait. | diff --git a/src/key.rs b/src/key.rs
index 26d8e0f..0228ee2 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -282,6 +282,15 @@ impl RSAPrivateKey {
k
}
+ /// Get the public key from the private key, cloning `n` and `e`.
+ ///
+ /// Generally this is not needed since `RSAPrivateKey` implements the `P... | 1 | 9 | 0 |
df157b4105aa2a19670e32a9ed1676f58d04f866 | Patrick D Hayes | 2019-03-19T15:07:14 | docs(cargo.toml): add readme reference
This will make the readme appear on crates.io | diff --git a/Cargo.toml b/Cargo.toml
index 3292da9..5d18f33 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,6 +8,7 @@ documentation = "https://docs.rs/rsa"
repository = "https://github.com/RustCrypto/RSA"
keywords = ["rsa", "encryption", "security", "crypto"]
categories = ["cryptography"]
+readme = "README.md"
[de... | 1 | 1 | 0 |
ee66f6a50594104e0d2d0e78c4b64873719bee81 | phayes | 2019-03-18T16:39:35 | rustfmt on benches | diff --git a/benches/key.rs b/benches/key.rs
index 22fec09..18e2a1e 100644
--- a/benches/key.rs
+++ b/benches/key.rs
@@ -1,22 +1,16 @@
#![feature(test)]
-use base64;
-
-
-
-
-
extern crate test;
+use base64;
use num_bigint::BigUint;
use num_traits::{FromPrimitive, Num};
use rand::{SeedableRng, StdRng};
-use sh... | 1 | 3 | 9 |
558d34f1551e56a25895f229f493806893da30b0 | phayes | 2019-03-18T16:34:29 | Moving to 2018 edition and applying 2018 idioms | diff --git a/Cargo.toml b/Cargo.toml
index 3292da9..c57de20 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,6 +2,7 @@
name = "rsa"
version = "0.1.3-alpha.0"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
+edition = "2018"
description = "Pure Rust RSA implementation"
license = "MIT ... | 3 | 16 | 16 |
bbd63fbba42a682636484b6cacd33a2d88f6ea5e | phayes | 2019-03-18T16:29:05 | Switch to using for all crate level uses | diff --git a/src/algorithms.rs b/src/algorithms.rs
index 352b6be..a02e884 100644
--- a/src/algorithms.rs
+++ b/src/algorithms.rs
@@ -3,8 +3,8 @@ use num_bigint::{BigUint, RandPrime};
use num_traits::{FromPrimitive, One, Zero};
use rand::Rng;
-use errors::{Error, Result};
-use key::RSAPrivateKey;
+use crate::errors:... | 4 | 17 | 17 |
1703482ba9ce23a439e24131ec6d04abcb8816c7 | Patrick D Hayes | 2019-03-16T09:30:32 | feat: split (un)blind into their own functions, exposing raw RSA functions via `internals` module
* Splitting blind and unblind into their own functions
* Adding public functions to private-key for blinding and unblinding
* Re-exporting raw RSA functions into a 'danger' module
* Better documentation
* Typos and gr... | diff --git a/Cargo.toml b/Cargo.toml
index 95cd21a..3292da9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -48,3 +48,4 @@ name = "key"
default = []
nightly = ["subtle/nightly", "clear_on_drop/nightly"]
serde1 = ["num-bigint/serde", "serde"]
+expose-internals = []
\ No newline at end of file
diff --git a/src/internals.r... | 5 | 204 | 156 |
69739656c4401decbd25a05e47bc825954c25925 | dignifiedquire | 2019-02-25T09:48:17 | (cargo-release) start next development iteration 0.1.2 | diff --git a/Cargo.toml b/Cargo.toml
index f06619a..95cd21a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.1.2"
+version = "0.1.3-alpha.0"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
description = "Pure Rust RSA implementation"
lic... | 1 | 1 | 1 |
639f1fdbe5bf528a2dcb8cae5b154e8cb154f825 | dignifiedquire | 2019-02-25T09:47:59 | (cargo-release) version 0.1.2 | diff --git a/Cargo.toml b/Cargo.toml
index ada79ea..f06619a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.1.2-alpha.0"
+version = "0.1.2"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
description = "Pure Rust RSA implementation"
lic... | 1 | 1 | 1 |
ea09d34c756369154b43089e15bea723f4461cc4 | dignifiedquire | 2019-02-25T09:38:45 | feat: add support for SHA3 hashes | diff --git a/benches/key.rs b/benches/key.rs
index ac1bc81..67753bf 100644
--- a/benches/key.rs
+++ b/benches/key.rs
@@ -55,7 +55,7 @@ fn bench_rsa_2048_pkcsv1_sign_blinded(b: &mut Bencher) {
.sign_blinded(
&mut rng,
PaddingScheme::PKCS1v15,
- Some(&Hashes::... | 2 | 33 | 13 |
0c2247c6cea0d707cbe464de725cc681eb13d19b | dignifiedquire | 2019-02-20T20:06:55 | (cargo-release) start next development iteration 0.1.1 | diff --git a/Cargo.toml b/Cargo.toml
index 8073a58..ada79ea 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.1.1"
+version = "0.1.2-alpha.0"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
description = "Pure Rust RSA implementation"
lic... | 1 | 1 | 1 |
3c4d69bbfd3f4879d1fa8f3c8052486e3666ddb6 | dignifiedquire | 2019-02-20T20:06:39 | (cargo-release) version 0.1.1 | diff --git a/Cargo.toml b/Cargo.toml
index 1eacf7b..8073a58 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.1.1-alpha.0"
+version = "0.1.1"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
description = "Pure Rust RSA implementation"
lic... | 1 | 1 | 1 |
70a63fae8e1db4ab6570fb97802cbe57f292f230 | dignifiedquire | 2019-02-20T20:06:30 | chore: fixup cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index acef084..1eacf7b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,4 +1,4 @@
-[project]
+[package]
name = "rsa"
version = "0.1.1-alpha.0"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"] | 1 | 1 | 1 |
d1293353ebb465c2709e599921f598751302feb5 | dignifiedquire | 2019-02-20T20:04:57 | chore: cleanup cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index 73a9cc2..acef084 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,3 @@
-#cargo-features = ["namespaced-features"]
-
[project]
name = "rsa"
version = "0.1.1-alpha.0"
@@ -10,8 +8,6 @@ documentation = "https://docs.rs/rsa"
repository = "https://github.com/RustCrypto/RSA"
... | 1 | 0 | 4 |
00bdcfa3f5e5f63010e778c00e7e16fda379519a | dignifiedquire | 2019-02-20T19:28:02 | feat: implement serde serialization and deserialization | diff --git a/Cargo.toml b/Cargo.toml
index 89c7929..73a9cc2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,4 +1,6 @@
-[package]
+#cargo-features = ["namespaced-features"]
+
+[project]
name = "rsa"
version = "0.1.1-alpha.0"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
@@ -8,6 +10,8... | 3 | 99 | 6 |
f99d2160c18b8c70f7ae04da92d5e24a9295cd3f | dignifiedquire | 2019-02-20T17:50:46 | chore: update dependencies | diff --git a/Cargo.toml b/Cargo.toml
index 0f45cab..00cb971 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,8 +10,7 @@ keywords = ["rsa", "encryption", "security", "crypto"]
categories = ["cryptography"]
[dependencies]
-#num-bigint-dig = { version = "0.2", features = ["rand", "i128", "u64_digit", "prime"] }
-num-bi... | 2 | 7 | 4 |
0172d0bf4a5ce3bc81d89b9170c967306e76a073 | 李伟 | 2019-01-23T10:07:56 | fix: update code to match latest `master` of num-bigint-dig
Fixed up some type errors between BigInt and BigUint. | diff --git a/src/algorithms.rs b/src/algorithms.rs
index bf16b67..352b6be 100644
--- a/src/algorithms.rs
+++ b/src/algorithms.rs
@@ -98,7 +98,7 @@ pub fn generate_multi_prime_key<R: Rng>(
let exp = BigUint::from_u64(EXP).expect("invalid static exponent");
if let Some(d) = exp.mod_inverse(totient) {
... | 2 | 3 | 4 |
2608f426402eea68272bddb618e1eac65bb4a84f | dignifiedquire | 2019-01-15T20:05:45 | refactor: remove prime and math tooling now in num_bigint | diff --git a/Cargo.toml b/Cargo.toml
index 8dc4ee7..0f45cab 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,7 +10,8 @@ keywords = ["rsa", "encryption", "security", "crypto"]
categories = ["cryptography"]
[dependencies]
-num-bigint-dig = { version = "0.2", features = ["rand", "i128", "u64_digit"] }
+#num-bigint-dig ... | 9 | 10 | 1,061 |
7654e6094b00f5e180bed2343a3fc47e45832b5e | dignifiedquire | 2018-12-13T08:38:06 | feat: generalize mod_inverse | diff --git a/src/algorithms.rs b/src/algorithms.rs
index e144937..25c93c3 100644
--- a/src/algorithms.rs
+++ b/src/algorithms.rs
@@ -32,7 +32,7 @@ pub fn generate_multi_prime_key<R: Rng>(
if bit_size < 64 {
let prime_limit = (1u64 << (bit_size / nprimes) as u64) as f64;
- println!("{} {}", prime_... | 2 | 110 | 67 |
ce43fa2ad82985388ac8225c526ee6c4f0ddd036 | dignifiedquire | 2018-12-13T08:37:11 | feat: expose math utils | diff --git a/src/lib.rs b/src/lib.rs
index da292cb..6394bfa 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -22,10 +22,10 @@ pub use prime_rand::RandPrime;
pub mod errors;
pub mod padding;
pub use key::{PublicKey, RSAPrivateKey, RSAPublicKey};
+pub mod algorithms;
pub mod hash;
+pub mod math;
-mod algorithms;
mod ke... | 1 | 2 | 2 |
42b4abbb20b6c166a5af8955ac0433559ed08f87 | dignifiedquire | 2018-12-05T20:19:34 | (cargo-release) start next development iteration 0.1.1-alpha.0 | diff --git a/Cargo.toml b/Cargo.toml
index b8dde5a..8dc4ee7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.1.0"
+version = "0.1.1-alpha.0"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
description = "Pure Rust RSA implementation"
lic... | 1 | 1 | 1 |
645cd685d3fd264b7972a2d275d2cbf9571a58c2 | dignifiedquire | 2018-12-04T11:34:11 | fix(decryption): ensure values are positive
Fixes #2 | diff --git a/src/algorithms.rs b/src/algorithms.rs
index 97041c8..e144937 100644
--- a/src/algorithms.rs
+++ b/src/algorithms.rs
@@ -96,7 +96,7 @@ pub fn generate_multi_prime_key<R: Rng>(
continue 'next;
}
- let exp = BigUint::from_u64(EXP).unwrap();
+ let exp = BigUint::from_u64(E... | 3 | 63 | 29 |
90e2e04addf8f65f946e641e02c3051a64fcf180 | dignifiedquire | 2018-11-24T11:07:30 | chore: fix keywords | diff --git a/Cargo.toml b/Cargo.toml
index 0da912d..1cb0ce3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0"
homepage = "https://github.com/dignifiedquire/rust-rsa"
repository = "https://github.com/dignifiedquire/rust-rsa"
-keywords = ["rsa", "encryption", "security", "public k... | 1 | 1 | 1 |
92bd8fa3bb4978d10121a8278a20d62796513f1a | dignifiedquire | 2018-11-24T11:06:43 | use published fork of num-bigint | diff --git a/Cargo.toml b/Cargo.toml
index 7c0b897..0da912d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,8 +10,7 @@ repository = "https://github.com/dignifiedquire/rust-rsa"
keywords = ["rsa", "encryption", "security", "public key crypto"]
[dependencies]
-# num-bigint = { path = "../num-bigint", features = ["ran... | 2 | 2 | 3 |
0a5e538cccb24235520c1cf2fa7189d0a15dfeaf | dignifiedquire | 2018-11-24T11:01:15 | feat: provide way to create a PublicKey from its parts | diff --git a/src/key.rs b/src/key.rs
index 4f20fad..8bedd0c 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -97,6 +97,14 @@ impl PublicKey for RSAPublicKey {
}
impl RSAPublicKey {
+ /// Create a new key from its components.
+ pub fn new(n: BigUint, e: BigUint) -> Result<Self> {
+ let k = RSAPublicKey { n, ... | 1 | 8 | 0 |
fe7c5105fb6adbea90aaa84949130f216ee2d056 | dignifiedquire | 2018-11-08T17:17:59 | feat: use BigUint to represent the exponent | diff --git a/src/algorithms.rs b/src/algorithms.rs
index 871fdd4..97041c8 100644
--- a/src/algorithms.rs
+++ b/src/algorithms.rs
@@ -8,7 +8,7 @@ use num_traits::{FromPrimitive, One, Zero};
use prime_rand::RandPrime;
/// Default exponent for RSA keys.
-const EXP: u32 = 65537;
+const EXP: u64 = 65537;
// Generates... | 4 | 41 | 28 |
4d046fa70eadb5789b55cabe2e95729f8423624e | dignifiedquire | 2018-11-07T13:28:16 | chore: some code cleanup from clippy | diff --git a/src/key.rs b/src/key.rs
index 1525b8c..a87a6ab 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -234,7 +234,7 @@ impl RSAPrivateKey {
let mut m = BigUint::one();
for prime in &self.primes {
// Any primes ≤ 1 will cause divide-by-zero panics later.
- if prime < &BigUint:... | 4 | 10 | 10 |
b4c9434c97d7cb7f5d5d414910b662aa74059ecb | dignifiedquire | 2018-11-07T13:20:05 | feat: use u64 limbs in the bignums | diff --git a/Cargo.toml b/Cargo.toml
index 5e25b38..7c0b897 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,22 +11,21 @@ keywords = ["rsa", "encryption", "security", "public key crypto"]
[dependencies]
# num-bigint = { path = "../num-bigint", features = ["rand", "i128"] }
-num-bigint = { git = "https://github.com/d... | 2 | 19 | 22 |
73cbdd7c0d7aa0d88bd1b2daf819fad317e85714 | dignifiedquire | 2018-07-24T21:46:58 | fix: proper error handling | diff --git a/src/algorithms.rs b/src/algorithms.rs
index 2ca867e..871fdd4 100644
--- a/src/algorithms.rs
+++ b/src/algorithms.rs
@@ -1,6 +1,6 @@
use rand::Rng;
-use errors::Result;
+use errors::{Error, Result};
use key::RSAPrivateKey;
use math::ModInverse;
use num_bigint::BigUint;
@@ -27,7 +27,7 @@ pub fn generat... | 4 | 58 | 49 |
f6f909d34426193dd36d06643bbaaffc566610e5 | dignifiedquire | 2018-07-24T20:04:41 | feat: implement pkcs1v15 signature verification | diff --git a/src/key.rs b/src/key.rs
index d0c14fc..a0606ab 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -108,6 +108,27 @@ impl RSAPublicKey {
)),
}
}
+
+ /// Verify a signed message.
+ /// `hashed`must be the result of hashing the input using the hashing function
+ /// passed in thro... | 2 | 82 | 1 |
4d46e98db718eb8da81ea103e930ece14045cfc8 | dignifiedquire | 2018-07-24T14:05:43 | feat(decrypt): implement precomputations, to speed up private operations | diff --git a/src/key.rs b/src/key.rs
index c30979d..d0c14fc 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -1,5 +1,6 @@
-use num_bigint::{BigUint, RandBigInt};
-use num_traits::{FromPrimitive, One, Zero};
+use num_bigint::Sign::Plus;
+use num_bigint::{BigInt, BigUint, RandBigInt};
+use num_traits::{FromPrimitive, One, Sig... | 1 | 149 | 5 |
79bb8fa9b3bfb3d65a8480bc636daf3de2ad76f8 | dignifiedquire | 2018-07-24T13:09:03 | test(bench): add decrypt and sign benchmarks | diff --git a/Cargo.toml b/Cargo.toml
index 0d37475..5e25b38 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,10 +24,18 @@ subtle = "^0.7"
[dev-dependencies]
base64 = "*"
sha-1 = "^0.7"
+sha2 = "^0.7"
hex = "^0.3"
+
+[[bench]]
+name = "prime"
+
+[[bench]]
+name = "key"
+
[profile.release]
-debug = true
+# debug = ... | 4 | 76 | 3 |
3943cd44fbc85292366cf7cfd593e0187974e5f0 | dignifiedquire | 2018-07-24T12:31:06 | feat: implemen pkcs1v15 signing | diff --git a/Cargo.toml b/Cargo.toml
index 92d2098..0d37475 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,6 +23,8 @@ subtle = "^0.7"
[dev-dependencies]
base64 = "*"
+sha-1 = "^0.7"
+hex = "^0.3"
[profile.release]
debug = true
diff --git a/src/hash.rs b/src/hash.rs
new file mode 100644
index 0000000..0273183
-... | 6 | 291 | 19 |
6d2b75686465083bd68e7dab0805f53944004d9b | dignifiedquire | 2018-07-23T23:01:44 | feat: implement pkcs1v15 encryption and decryption | diff --git a/Cargo.toml b/Cargo.toml
index e5ea9c8..92d2098 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,7 +2,7 @@
name = "rsa"
version = "0.1.0"
authors = ["dignifiedquire <dignifiedquire@gmail.com>"]
-description = "PGP implementation in Rust"
+description = "RSA implementation in Rust"
license = "MIT OR Apache... | 6 | 385 | 19 |
f3fdf952b93455abcb228256cd2b6336996837e7 | dignifiedquire | 2018-07-20T12:42:16 | feat(key): ensure impossible keys are properly handled | diff --git a/src/algorithms.rs b/src/algorithms.rs
index 161e57a..8eb8118 100644
--- a/src/algorithms.rs
+++ b/src/algorithms.rs
@@ -26,7 +26,9 @@ pub fn generate_multi_prime_key<R: Rng>(
nprimes: usize,
bit_size: usize,
) -> Result<RSAPrivateKey> {
- assert!(nprimes >= 2, "nprimes must be >= 2");
+ if... | 2 | 15 | 1 |
61ca0d31a77f12400a6f2de09999061d79873eaa | dignifiedquire | 2018-07-20T12:38:00 | test(key): fixup key generation test params | diff --git a/src/key.rs b/src/key.rs
index 9745721..2a900a4 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -177,6 +177,6 @@ mod tests {
key_generation!(key_generation_multi_4_64, 4, 64);
key_generation!(key_generation_multi_5_64, 5, 64);
- key_generation!(key_generation_multi_8_64, 8, 64);
- // key_gener... | 1 | 2 | 2 |
0e2cb81d2d18dd6784c2cd5b399f8327e1e52cd8 | dignifiedquire | 2018-07-20T12:31:48 | basic key generation is working | diff --git a/src/algorithms.rs b/src/algorithms.rs
index 169cc74..161e57a 100644
--- a/src/algorithms.rs
+++ b/src/algorithms.rs
@@ -4,9 +4,10 @@ use errors::Result;
use key::RSAPrivateKey;
use math::ModInverse;
use num_bigint::BigUint;
-use num_traits::{FromPrimitive, One};
+use num_traits::{FromPrimitive, One, Zer... | 3 | 106 | 6 |
ef653a33a934cce655f97f1171ce05d11bbdffcf | dignifiedquire | 2018-07-19T19:31:41 | feat: implement basic private key generation | diff --git a/Cargo.toml b/Cargo.toml
index 254236c..e5ea9c8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,3 +19,4 @@ num-iter = "^0.1"
lazy_static = "^1.0"
rand = "^0.5"
byteorder = "^1.2"
+failure = "*"
diff --git a/src/algorithms.rs b/src/algorithms.rs
new file mode 100644
index 0000000..169cc74
--- /dev/null
++... | 6 | 295 | 1 |
33c169ae1997a42d1ec2d0813a8bfc50a950d069 | dignifiedquire | 2018-07-19T14:19:30 | feat(key): implement basic key structs | diff --git a/src/key.rs b/src/key.rs
new file mode 100644
index 0000000..a5b715b
--- /dev/null
+++ b/src/key.rs
@@ -0,0 +1,66 @@
+use num_bigint::BigUint;
+
+/// Represents the public part of an RSA key.
+pub struct RSAPublicKey {
+ n: BigUint,
+ e: u32,
+}
+
+/// Represents a whole RSA key, public and private pa... | 2 | 68 | 2 |
124e4b6dc76d4d18b599fe3a42cc6e3081a6cd75 | dignifiedquire | 2018-07-19T14:01:17 | feat(prime): implement RandPrime | diff --git a/Cargo.toml b/Cargo.toml
index 10eac7a..254236c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,6 +15,7 @@ keywords = ["rsa", "encryption", "security", "public key crypto"]
num-bigint = { git = "https://github.com/dignifiedquire/num-bigint", features = ["rand"] }
num-traits = "^0.2"
num-integer = "^0.1"
... | 5 | 187 | 31 |
1c0e049b1e493b822b8909304ee996df2ec323eb | dignifiedquire | 2018-07-19T08:08:16 | refactor(prime): use static values | diff --git a/src/prime.rs b/src/prime.rs
index 779b786..a114a47 100644
--- a/src/prime.rs
+++ b/src/prime.rs
@@ -11,6 +11,9 @@ use rand::{SeedableRng, StdRng};
use math::jacobi;
lazy_static! {
+ static ref BIG_1: BigUint = BigUint::one();
+ static ref BIG_2: BigUint = BigUint::from_u64(2).unwrap();
+ stati... | 1 | 12 | 9 |
f657ca6cf3f4278e5aacbd5d2a659b862316ae43 | dignifiedquire | 2018-07-18T21:29:22 | chore: fix doc formatting | diff --git a/src/prime.rs b/src/prime.rs
index 6a83074..779b786 100644
--- a/src/prime.rs
+++ b/src/prime.rs
@@ -229,14 +229,15 @@ pub fn probably_prime_lucas(n: &BigUint) -> bool {
let r = s.trailing_zeros().unwrap();
s = &s >> r;
let nm2 = n - BigUint::from_u64(2).unwrap(); // n - 2
- ... | 1 | 9 | 8 |
dc021a42177ef5224f7c99258d0e1c0038f1f364 | dignifiedquire | 2018-07-18T21:03:47 | test(prime): add benchmarks | diff --git a/benches/prime.rs b/benches/prime.rs
new file mode 100644
index 0000000..b8ca91d
--- /dev/null
+++ b/benches/prime.rs
@@ -0,0 +1,53 @@
+#![feature(test)]
+
+extern crate num_bigint;
+extern crate num_traits;
+extern crate rsa;
+extern crate test;
+
+use num_bigint::BigUint;
+use rsa::prime;
+
+use test::Ben... | 2 | 57 | 3 |
61861b992e7961c0b3f6a04fc4e00d93d91d6e13 | dignifiedquire | 2018-07-18T20:44:23 | feat: probably_prime passes tests | diff --git a/Cargo.toml b/Cargo.toml
index 80da226..10eac7a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,3 +17,4 @@ num-traits = "^0.2"
num-integer = "^0.1"
lazy_static = "^1.0"
rand = "^0.5"
+byteorder = "*"
diff --git a/src/lib.rs b/src/lib.rs
index 334bd4c..c3306e5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -... | 4 | 190 | 58 |
3f6b404a138bf81089de6f6ffc5eb766f23fc66a | dignifiedquire | 2018-07-18T00:13:49 | primes: cleanup and more tests | diff --git a/src/math.rs b/src/math.rs
index e57816b..237af28 100644
--- a/src/math.rs
+++ b/src/math.rs
@@ -14,7 +14,6 @@ pub fn jacobi(x: &BigInt, y: &BigInt) -> isize {
let mut a = x.clone();
let mut b = y.clone();
- let mut c = BigInt::zero();
let mut j = 1;
if b.is_negative() {
@@ -48,7 ... | 2 | 47 | 4 |
b66e7a0c4b18b8c0def85c1b9ad33c4e4a25ffdb | dignifiedquire | 2018-07-17T23:50:00 | feat(prime): implement jacobi and first part of lucas | diff --git a/src/lib.rs b/src/lib.rs
index fc2b068..334bd4c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -5,4 +5,5 @@ extern crate num_traits;
extern crate lazy_static;
extern crate rand;
+mod math;
pub mod prime;
diff --git a/src/math.rs b/src/math.rs
new file mode 100644
index 0000000..e57816b
--- /dev/null
+++ b... | 3 | 162 | 4 |
76cb187636942454973981c07448c72a39654763 | dignifiedquire | 2018-07-17T22:07:47 | feat: first part of prime tests | diff --git a/Cargo.toml b/Cargo.toml
index 2367a7e..80da226 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,6 +10,10 @@ repository = "https://github.com/dignifiedquire/rust-rsa"
keywords = ["rsa", "encryption", "security", "public key crypto"]
[dependencies]
-num-bigint = "^0.2"
+# num-bigint = "^0.2"
+# num-bigint... | 3 | 265 | 11 |
3b4b1b090a46bf70b72aa2d24eb3dfa154cf96df | Mattia Penati | 2026-04-11T09:58:02 | Fix typos (#543) | diff --git a/src/array.rs b/src/array.rs
index d11aac3b..6f82abec 100644
--- a/src/array.rs
+++ b/src/array.rs
@@ -61,7 +61,7 @@ use crate::untyped_array::{PyUntypedArray, PyUntypedArrayMethods};
///
/// # Element type and dimensionality
///
-/// `PyArray` has two type parametes `T` and `D`.
+/// `PyArray` has two t... | 7 | 17 | 17 |
3c382b37e4e3369fc2fcfcf79291025aeae7498a | Mattia Penati | 2026-03-29T01:06:10 | Use NumPy C API to implement object to array conversion | diff --git a/src/array_like.rs b/src/array_like.rs
index dfea5616..40a60802 100644
--- a/src/array_like.rs
+++ b/src/array_like.rs
@@ -2,15 +2,11 @@ use std::marker::PhantomData;
use std::ops::Deref;
use ndarray::{Array1, Dimension, Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, IxDyn};
-use pyo3::{
- intern,
- sync::PyO... | 1 | 26 | 23 |
9123c34ab529854daa47991e8e8ea837974541b0 | Mattia Penati | 2026-03-29T01:05:23 | Add benchmark for array like | diff --git a/Cargo.toml b/Cargo.toml
index 54d54c4e..d76aa8a8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -43,6 +43,10 @@ pyo3-build-config = { version = "0.28", features = ["resolve-config"]}
name = "array"
harness = false
+[[bench]]
+name = "array_like"
+harness = false
+
[[bench]]
name = "borrow"
harness = fa... | 2 | 108 | 0 |
099b0eda537e53e8096f8b41e6b22f80b919f88a | Mattia Penati | 2026-03-25T19:02:07 | Replace `std::os::raw` with `std::ffi` (#540) | diff --git a/src/array.rs b/src/array.rs
index f9a88d4e..d11aac3b 100644
--- a/src/array.rs
+++ b/src/array.rs
@@ -3,10 +3,9 @@
//! [ndarray]: https://numpy.org/doc/stable/reference/arrays.ndarray.html
use std::{
+ ffi::{c_int, c_void},
marker::PhantomData,
- mem,
- os::raw::{c_int, c_void},
- ptr,... | 5 | 6 | 8 |
69ca88e5be2a344eba347b9b6f50e410c0b9191f | Ben Beasley | 2026-01-08T15:03:58 | Convert build.rs from CRLF to LF line terminators (#521) | diff --git a/build.rs b/build.rs
index 6b746f1a..0475124b 100644
--- a/build.rs
+++ b/build.rs
@@ -1,3 +1,3 @@
-fn main() {
- pyo3_build_config::use_pyo3_cfgs();
-}
+fn main() {
+ pyo3_build_config::use_pyo3_cfgs();
+} | 1 | 3 | 3 |
70ffab6c30a8ae7d3a50cde0ae0d41d985ead8c3 | Benjamin A. Beasley | 2025-09-01T18:26:40 | Exclude some unnecessary files from the crate
Exclude from the published crate the contents of `.github/` (CI
workflows, etc.) and other files that are only useful for upstream
development, not for crate users (`.gitignore`, `codecov.yml`, `x.py`).
This slightly slims down the crate.
This is also helpful downstream, ... | diff --git a/Cargo.toml b/Cargo.toml
index e30f5305..c1d9b297 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,6 +13,12 @@ repository = "https://github.com/PyO3/rust-numpy"
categories = ["api-bindings", "development-tools::ffi", "science"]
keywords = ["python", "numpy", "ffi", "pyo3"]
license = "BSD-2-Clause"
+exclud... | 1 | 6 | 0 |
3d1116a525f87b67bc6d2a5897c28b1641841fd4 | Bas Schoenmaeckers | 2025-05-14T15:52:21 | update `pyo3` to 0.25 (#492) | diff --git a/Cargo.toml b/Cargo.toml
index 07a065d7..d935627d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "numpy"
-version = "0.24.0"
+version = "0.25.0"
authors = [
"The rust-numpy Project Developers",
"PyO3 Project and Contributors <https://github.com/PyO3>"
@@ -22,15 +22,15... | 9 | 10 | 264 |
5389a1e7b7e52a428d757b3f63554871ddd2608a | Dylan DPC | 2025-04-08T10:34:46 | Update Cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index 063507c2..07a065d7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,7 +22,7 @@ num-complex = ">= 0.2, < 0.5"
num-integer = "0.1"
num-traits = "0.2"
ndarray = ">= 0.15, < 0.17"
-pyo3 = { version = "0.24", default-features = false, features = ["macros"] }
+pyo3 = { version = "... | 1 | 1 | 1 |
1fc79b10deb0d898a90932762478a23b5dc7536b | Bas Schoenmaeckers | 2025-03-10T19:52:25 | update `pyo3` to 0.24 (#483)
* update `pyo3` to 0.24
* use `MutexExt` instead of `ThreadStateGuard` | diff --git a/Cargo.toml b/Cargo.toml
index 5054b008..9da21c57 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,15 +22,15 @@ num-complex = ">= 0.2, < 0.5"
num-integer = "0.1"
num-traits = "0.2"
ndarray = ">= 0.15, < 0.17"
-pyo3 = { version = "0.23.4", default-features = false, features = ["macros"] }
+pyo3 = { version... | 8 | 30 | 52 |
b34bc295414015931d6c7bd5350cab2c6c829d6e | Kevin Kainan Li | 2024-11-23T04:44:06 | Update rustc-hash to 2.0 | diff --git a/Cargo.toml b/Cargo.toml
index 90c74f45..26366c5a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,7 +23,7 @@ num-integer = "0.1"
num-traits = "0.2"
ndarray = ">= 0.15, < 0.17"
pyo3 = { version = "0.23.0", default-features = false, features = ["macros"] }
-rustc-hash = "1.1"
+rustc-hash = "2.0"
[dev-de... | 1 | 1 | 1 |
82d04668df4edd4c1236c87796265cbf9c191bd4 | Icxolu | 2024-11-19T21:20:14 | make `PySliceContainer` `Sync` | diff --git a/src/dtype.rs b/src/dtype.rs
index b6cbea0b..e22ac20a 100644
--- a/src/dtype.rs
+++ b/src/dtype.rs
@@ -697,7 +697,7 @@ impl Sealed for Bound<'_, PyArrayDescr> {}
///
/// [enumerated-types]: https://numpy.org/doc/stable/reference/c-api/dtype.html#enumerated-types
/// [data-models]: https://en.wikipedia.or... | 2 | 12 | 4 |
0f1dd034f60c4af6fd5765bd8e3651b3a05ae951 | Jonas Pleyer | 2024-11-01T20:57:53 | allow versions =>0.30 <0.34 for `nalgebra` | diff --git a/Cargo.toml b/Cargo.toml
index f18e2744..5c9e852c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,7 +17,7 @@ license = "BSD-2-Clause"
[dependencies]
half = { version = "2.0", default-features = false, optional = true }
libc = "0.2"
-nalgebra = { version = "0.32", default-features = false, optional = true... | 1 | 2 | 2 |
327ab1006207b0d0563b18ea419976b61f6f1803 | Jake Lishman | 2024-10-11T17:55:05 | Add `From<PyReadwriteArray>` for `PyReadonlyArray`
The ordering of drops is important for the dynamic checker, so this is a
convenience for conversion. | diff --git a/src/borrow/mod.rs b/src/borrow/mod.rs
index 8dd28b29..bcfb4028 100644
--- a/src/borrow/mod.rs
+++ b/src/borrow/mod.rs
@@ -175,8 +175,8 @@ use crate::array::{PyArray, PyArrayMethods};
use crate::convert::NpyIndex;
use crate::dtype::Element;
use crate::error::{BorrowError, NotContiguousError};
-use crate:... | 1 | 15 | 2 |
a4b922f08fba98992421b008efb62a0f00db0f22 | Jake Lishman | 2024-10-11T17:12:17 | Add safe interface to clear `WRITEABLE` flag
The dynamic borrow checker for `PyReadwriteArray` understood the flag,
but the crate offered no public way to set it. General manipulation of
the `flags` field is unsafe (things like `OWNDATA` should never be
modified by hand), but flipping the `WRITEABLE` flag to `false` ... | diff --git a/src/array.rs b/src/array.rs
index 40b8eb36..cdaead70 100644
--- a/src/array.rs
+++ b/src/array.rs
@@ -420,6 +420,9 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
/// Creates a NumPy array backed by `array` and ties its ownership to the Python object `container`.
///
+ /// The resulting Nu... | 3 | 35 | 1 |
64145d292f453bc2e692ffbb27e39cf2eaace404 | Jake Lishman | 2024-10-21T20:50:19 | Fix static-size FFI type aliases
Several type aliases with statically sized names (e.g. `npy_uint64`)
were being aliased to platform-dependent types like
`::std::os::raw::c_long`. Most of these were barely used, so it seems
like they didn't cause problems before, but now with `npy_uint64` being
used in certain struct... | diff --git a/src/npyffi/types.rs b/src/npyffi/types.rs
index 68df9c52..eb03b801 100644
--- a/src/npyffi/types.rs
+++ b/src/npyffi/types.rs
@@ -19,15 +19,15 @@ pub type npy_long = c_long;
pub type npy_float = f32;
pub type npy_double = f64;
pub type npy_hash_t = Py_hash_t;
-pub type npy_int64 = c_long;
-pub type npy_... | 1 | 8 | 8 |
d07dbf528e03b429c5aa8c1eb2f4ebfa5d73d43c | David Hewitt | 2024-10-11T11:29:16 | apply check for `core` vs `_core` at runtime | diff --git a/src/array.rs b/src/array.rs
index 73670c15..40b8eb36 100644
--- a/src/array.rs
+++ b/src/array.rs
@@ -122,7 +122,7 @@ pub type PyArrayDyn<T> = PyArray<T, IxDyn>;
/// Returns a handle to NumPy's multiarray module.
pub fn get_array_module<'py>(py: Python<'py>) -> PyResult<Bound<'_, PyModule>> {
- PyMo... | 3 | 50 | 5 |
7e702be1bc405e407014004fa83a2740f1bbcc53 | Euan | 2024-10-09T22:05:38 | changed core module call to _core | diff --git a/src/npyffi/array.rs b/src/npyffi/array.rs
index 7074f61c..a0971c2a 100644
--- a/src/npyffi/array.rs
+++ b/src/npyffi/array.rs
@@ -14,7 +14,7 @@ use pyo3::{
use crate::npyffi::*;
-pub(crate) const MOD_NAME: &str = "numpy.core.multiarray";
+pub(crate) const MOD_NAME: &str = "numpy._core.multiarray";
co... | 1 | 1 | 1 |
505a79ce1b1b6695fbedd191a55ed1e89c34582a | David Hewitt | 2024-10-06T06:05:57 | restore allow deprecated | diff --git a/src/lib.rs b/src/lib.rs
index 23be38db..2b2d1f08 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -112,6 +112,7 @@ pub use crate::borrow::{
};
pub use crate::convert::{IntoPyArray, NpyIndex, ToNpyDims, ToPyArray};
#[cfg(feature = "gil-refs")]
+#[allow(deprecated)]
pub use crate::dtype::dtype;
pub use crate... | 1 | 2 | 0 |
f46bd072af4f35fa167fce1daa3067bef28f9673 | David Hewitt | 2024-10-06T06:03:46 | restore deprecation messages | diff --git a/src/array.rs b/src/array.rs
index 8c6a6352..73670c15 100644
--- a/src/array.rs
+++ b/src/array.rs
@@ -229,6 +229,7 @@ impl<T, D> PyArray<T, D> {
/// assert_eq!(array.bind(py).readonly().as_slice().unwrap(), [0.0; 5]);
/// });
/// ```
+ #[deprecated(since = "0.21.0", note = "use Bound:... | 3 | 87 | 0 |
ad4b4bfee181ba8ad19ccb30507b76c938d78d12 | Joshua Rudolph | 2024-10-05T20:19:09 | cargo fmt | diff --git a/src/datetime.rs b/src/datetime.rs
index 8d4b7cfa..50daa269 100644
--- a/src/datetime.rs
+++ b/src/datetime.rs
@@ -66,7 +66,7 @@ use std::marker::PhantomData;
use pyo3::{sync::GILProtected, Bound, Py, Python};
use rustc_hash::FxHashMap;
-use crate::dtype::{Element, PyArrayDescr, PyArrayDescrMethods, clo... | 2 | 6 | 6 |
71a30c22cb01f6f45821ca7d4bfb864f8c2d6925 | Joshua Rudolph | 2024-10-05T20:02:53 | Removed `PyClone` trait, moved it methods to `Element`, and updated implementations/usages.
The updates including renaming the `py_clone` method to `clone_ref` to match that of `Py::clone_ref`, and replacing the `impl_py_clone!` macro with `clone_methods_impl!`. | diff --git a/src/array.rs b/src/array.rs
index 68b7b8e1..8c6a6352 100644
--- a/src/array.rs
+++ b/src/array.rs
@@ -1473,7 +1473,7 @@ unsafe fn clone_elements<T: Element>(py: Python<'_>, elems: &[T], data_ptr: &mut
*data_ptr = data_ptr.add(elems.len());
} else {
for elem in elems {
- da... | 6 | 75 | 143 |
ae95f69755237b373b3bfb2bf887b47cc78b0337 | Joshua Rudolph | 2024-10-05T19:02:32 | Restored deprecation warning for `IntoPyArray::into_pyarray` and `ToPyArray::to_pyarray` | diff --git a/src/convert.rs b/src/convert.rs
index fa7b26d3..28296255 100644
--- a/src/convert.rs
+++ b/src/convert.rs
@@ -41,6 +41,10 @@ pub trait IntoPyArray: Sized {
type Dim: Dimension;
/// Deprecated form of [`IntoPyArray::into_pyarray_bound`]
+ #[deprecated(
+ since = "0.21.0",
+ note... | 1 | 8 | 0 |
6caa75b9ca182c712fb8ce04c69b37374e192ff4 | jrudolph | 2024-08-01T23:45:57 | Fixed example crate attempting to clone a PyObject. | diff --git a/examples/simple/src/lib.rs b/examples/simple/src/lib.rs
index a2cbbe7f..fa1c844c 100644
--- a/examples/simple/src/lib.rs
+++ b/examples/simple/src/lib.rs
@@ -16,9 +16,9 @@ use pyo3::{
#[pymodule]
fn rust_ext<'py>(m: &Bound<'py, PyModule>) -> PyResult<()> {
// example using generic PyObject
- fn h... | 1 | 3 | 3 |
234227aba89b003bec1322b83d1e92a5add8044d | jrudolph | 2024-08-01T15:16:22 | Bumped pyo3 dependency version in the example crates. | diff --git a/examples/linalg/Cargo.toml b/examples/linalg/Cargo.toml
index 3d855801..fc4a3a29 100644
--- a/examples/linalg/Cargo.toml
+++ b/examples/linalg/Cargo.toml
@@ -9,7 +9,7 @@ name = "rust_linalg"
crate-type = ["cdylib"]
[dependencies]
-pyo3 = { version = "0.21.0", features = ["extension-module"] }
+pyo3 = {... | 3 | 3 | 3 |
7c70c709611a5c9aea8825dfd87b10839d0a4ad7 | jrudolph | 2024-07-14T03:56:52 | Added `PyClone` to the crate's root namespace. | diff --git a/src/lib.rs b/src/lib.rs
index 23be38db..90d74b6e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -114,7 +114,7 @@ pub use crate::convert::{IntoPyArray, NpyIndex, ToNpyDims, ToPyArray};
#[cfg(feature = "gil-refs")]
pub use crate::dtype::dtype;
pub use crate::dtype::{
- dtype_bound, Complex32, Complex64, E... | 1 | 1 | 1 |
56f6795a10e2607d84afed945fdf40e4e1536661 | jrudolph | 2024-07-13T22:26:14 | Updated docs to use non-deprecated APIs. | diff --git a/src/borrow/mod.rs b/src/borrow/mod.rs
index de927fe9..a1cb203e 100644
--- a/src/borrow/mod.rs
+++ b/src/borrow/mod.rs
@@ -305,7 +305,7 @@ where
/// }
///
/// Python::with_gil(|py| {
- /// let np = py.eval("__import__('numpy')", None, None).unwrap();
+ /// let np = py.eval_bound... | 2 | 3 | 3 |
2dc084857280c25aad7b4778234e18ddcbf6d161 | jrudolph | 2024-07-13T22:17:54 | Formatting and cleanup. | diff --git a/src/array.rs b/src/array.rs
index b959354d..68b7b8e1 100644
--- a/src/array.rs
+++ b/src/array.rs
@@ -2271,7 +2271,7 @@ impl<'py, T, D> PyArrayMethods<'py, T, D> for Bound<'py, PyArray<T, D>> {
as_view(self, |shape, ptr| unsafe {
RawArrayViewMut::from_shape_ptr(shape, ptr)
})... | 4 | 35 | 36 |
6d25071200bdab722a0cd95a55bd7498665ad47b | jrudolph | 2024-07-13T20:33:47 | Minor tweaks to please the lint gods. | diff --git a/src/array.rs b/src/array.rs
index a1aa5ebf..b959354d 100644
--- a/src/array.rs
+++ b/src/array.rs
@@ -239,7 +239,7 @@ impl<T, D> PyArray<T, D> {
///
/// This is a wrapper around [`pyo3::FromPyPointer::from_owned_ptr_or_opt`] and inherits its safety contract.
pub unsafe fn from_owned_ptr<'py>... | 3 | 7 | 5 |
f4dd5d4279a6af31d0d41f43ca9fecb751074bc4 | jrudolph | 2024-07-13T20:32:24 | Feature-gated the crate-level `deny(missing_debug_implementations)` attribute.
This is necessary since the `pyo3::pyobject_native_type_base` macro only implements `Debug` with the "gil-refs" feature since the 0.22.0 update. The `Debug` impls are no longer relevant anyway because `&PyArray`, `&PyArrayDescr`, etc. can o... | diff --git a/src/lib.rs b/src/lib.rs
index c43995c4..7c5ef1f5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -69,8 +69,11 @@ as well as the [`PyReadonlyArray::try_as_matrix`] and [`PyReadwriteArray::try_as
//!
//! [c-api]: https://numpy.org/doc/stable/reference/c-api
//! [ndarray]: https://numpy.org/doc/stable/referenc... | 1 | 5 | 2 |
199fcc5acef2e27e58b4539266f7304ccd463896 | jrudolph | 2024-07-13T20:21:48 | Added necessary "gil-refs" feature gate to the `nalgebra`-specific `PyArray` impl block. | diff --git a/src/array.rs b/src/array.rs
index f6495dbc..a1aa5ebf 100644
--- a/src/array.rs
+++ b/src/array.rs
@@ -923,6 +923,7 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
}
#[cfg(feature = "nalgebra")]
+#[cfg(feature = "gil-refs")]
impl<N, D> PyArray<N, D>
where
N: nalgebra::Scalar + Element, | 1 | 1 | 0 |
ab8cc521aa5b7eaada9080fd35400100368fd15f | jrudolph | 2024-07-13T20:16:42 | Updated `Element` impl for `bf16` to call `py_clone` instead of `clone`. | diff --git a/src/dtype.rs b/src/dtype.rs
index 704793fb..45188614 100644
--- a/src/dtype.rs
+++ b/src/dtype.rs
@@ -867,7 +867,7 @@ unsafe impl Element for bf16 {
.get_or_init(py, || {
PyArrayDescr::new_bound(py, "bfloat16").expect("A package which provides a `bfloat16` data type for NumPy ... | 1 | 1 | 1 |
db1a1a38471dc5a7b0635e525b0b3df46115220e | jrudolph | 2024-07-13T20:16:03 | Updated `ToPyArray` impls to call `py_clone` instead of `clone`. | diff --git a/src/convert.rs b/src/convert.rs
index 342758d9..fa7b26d3 100644
--- a/src/convert.rs
+++ b/src/convert.rs
@@ -195,7 +195,7 @@ where
let array = PyArray::<A, _>::new_bound(py, dim, false);
let mut data_ptr = array.data();
for item in self.iter()... | 1 | 2 | 2 |
f291cf2145b0a372fe221922d6146975bd3df115 | jrudolph | 2024-07-13T19:55:04 | Updated methods in the `array` module to call `PyClone` methods instead of `Clone` methods.
This change is trivial since the GIL is already held everywhere that the clones occur, with the minor technicality that the GIL is not guaranteed to be held in the definition of the `PyArrayMethods` trait, but only in the actua... | diff --git a/src/array.rs b/src/array.rs
index a9f6e0ce..f6495dbc 100644
--- a/src/array.rs
+++ b/src/array.rs
@@ -1686,10 +1686,7 @@ pub trait PyArrayMethods<'py, T, D>: PyUntypedArrayMethods<'py> {
where
T: Element,
D: Dimension,
- Idx: NpyIndex<Dim = D>,
- {
- unsafe { self.ge... | 1 | 31 | 12 |
23c6a136acc9f7ab9711f440a3cb952b81c1024b | jrudolph | 2024-07-13T19:39:56 | Updated the private `array::clone_elements` function to require a GIL token and call the `py_clone` method instead of `Clone`.
Updated usages accordingly, which is trivial since the GIL is already held everywhere it is called. | diff --git a/src/array.rs b/src/array.rs
index 73585198..a9f6e0ce 100644
--- a/src/array.rs
+++ b/src/array.rs
@@ -1066,7 +1066,7 @@ impl<T: Element> PyArray<T, Ix1> {
unsafe {
let array = PyArray::new_bound(py, [slice.len()], false);
let mut data_ptr = array.data();
- clon... | 1 | 5 | 5 |
3d84909401605133f80987227d630ca9a4fd90ce | jrudolph | 2024-07-13T19:34:05 | Replaced `Clone` with `PyClone` as a supertrait of `Element`.
This is necessary in order to continue supporting object arrays after the update to PyO3 0.22.0 since `Py<T>` no longer implements `Clone` unless the 'py-clone' feature is enabled (which would be problematic for `numpy` to enable).
This is a breaking chang... | diff --git a/src/dtype.rs b/src/dtype.rs
index db1c8f1c..704793fb 100644
--- a/src/dtype.rs
+++ b/src/dtype.rs
@@ -731,7 +731,7 @@ pub trait PyClone: Sized {
///
/// [enumerated-types]: https://numpy.org/doc/stable/reference/c-api/dtype.html#enumerated-types
/// [data-models]: https://en.wikipedia.org/wiki/64-bit_co... | 1 | 1 | 1 |
d32f1c74020dbe48fdc8bd9a8c5cabce77225515 | jrudolph | 2024-07-13T19:20:42 | Added `PyClone` impl for `PyObject`.
This is the motivating impl for the changes, since `PyObject` can only be safely cloned while the GIL is held. | diff --git a/src/dtype.rs b/src/dtype.rs
index eab4a5bd..db1c8f1c 100644
--- a/src/dtype.rs
+++ b/src/dtype.rs
@@ -883,6 +883,13 @@ impl_element_scalar!(Complex64 => NPY_CDOUBLE,
#[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))]
impl_element_scalar!(usize, isize);
+impl PyClone for PyObject {
+ ... | 1 | 7 | 0 |
8e25d8c28fb41724d743be244df4ad5806d948b7 | jrudolph | 2024-07-13T19:16:33 | Added `PyClone` impls for the types in the `strings` module.
The impls were provided explicitly instead of using the `impl_py_clone` macro since making the macro flexible enough to handle the `const` param adds more complexity than it's worth. | diff --git a/src/strings.rs b/src/strings.rs
index 5e96da17..6364ceb5 100644
--- a/src/strings.rs
+++ b/src/strings.rs
@@ -17,7 +17,7 @@ use pyo3::{
};
use rustc_hash::FxHashMap;
-use crate::dtype::{Element, PyArrayDescr, PyArrayDescrMethods};
+use crate::dtype::{Element, PyArrayDescr, PyArrayDescrMethods, PyClone}... | 1 | 47 | 1 |
ab71b1efd1ccda1e85a2c9090242243733c981f2 | jrudolph | 2024-07-13T19:11:47 | Added `impl_py_clone` macro that provides an efficient `PyClone` impl for `Clone` types.
The `impl_element_scalar` macro has been updated to invoke this new macro, and an explicit invocation was added for the types in the `datetime` module. | diff --git a/src/datetime.rs b/src/datetime.rs
index b5a4c075..9d184fbc 100644
--- a/src/datetime.rs
+++ b/src/datetime.rs
@@ -66,7 +66,7 @@ use std::marker::PhantomData;
use pyo3::{sync::GILProtected, Bound, Py, Python};
use rustc_hash::FxHashMap;
-use crate::dtype::{Element, PyArrayDescr, PyArrayDescrMethods};
+u... | 2 | 38 | 1 |
437f5fa1f158c9ce99e3a8e321efcf80e52fc130 | jrudolph | 2024-07-13T19:01:36 | Added `PyClone` trait that will replace `Clone` as supertrait of `Element`.
This trait can be trivially implemented for `Clone` types, but can also be implemented for types such as `PyObject` that can only be safely cloned while the GIL is held. | diff --git a/src/dtype.rs b/src/dtype.rs
index a7f6eaa6..8f3b8eff 100644
--- a/src/dtype.rs
+++ b/src/dtype.rs
@@ -1,6 +1,7 @@
use std::mem::size_of;
use std::os::raw::{c_int, c_long, c_longlong, c_short, c_uint, c_ulong, c_ulonglong, c_ushort};
use std::ptr;
+use ndarray::{Array, ArrayView, Dimension};
#[cfg(fea... | 1 | 50 | 0 |
bcf5f523775f7ecdb280fc6b356811f621b699b0 | Bas Schoenmaeckers | 2024-06-27T14:22:31 | Don't enable gil-refs feature by default | diff --git a/Cargo.toml b/Cargo.toml
index 650dc0ea..b467b7ba 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -33,5 +33,4 @@ nalgebra = { version = "0.32", default-features = false, features = ["std"] }
all-features = true
[features]
-default = ["gil-refs"]
-"gil-refs" = ["pyo3/gil-refs"]
+gil-refs = ["pyo3/gil-refs"] | 1 | 1 | 2 |
51e0bea75fe748cc8cf206bd1a04ec798d73bdb3 | Bas Schoenmaeckers | 2024-06-27T14:21:27 | Update array | diff --git a/src/array.rs b/src/array.rs
index 76d62d1c..73585198 100644
--- a/src/array.rs
+++ b/src/array.rs
@@ -19,9 +19,11 @@ use num_traits::AsPrimitive;
use pyo3::{
ffi, pyobject_native_type_base,
types::{DerefToPyAny, PyAnyMethods, PyModule},
- AsPyPointer, Bound, DowncastError, FromPyObject, IntoP... | 2 | 141 | 167 |
a475cd89739b1bd588756db5c4900e7eb973cb56 | Bas Schoenmaeckers | 2024-06-27T14:21:44 | update dtype | diff --git a/src/dtype.rs b/src/dtype.rs
index 5e7b0118..a7f6eaa6 100644
--- a/src/dtype.rs
+++ b/src/dtype.rs
@@ -10,11 +10,12 @@ use pyo3::{
ffi::{self, PyTuple_Size},
pyobject_native_type_extract, pyobject_native_type_named,
types::{PyAnyMethods, PyDict, PyDictMethods, PyTuple, PyType},
- AsPyPoint... | 2 | 44 | 56 |
e5319221643710f4cbb3b1b59fb9af598881e31f | Bas Schoenmaeckers | 2024-06-27T09:23:19 | Update untyped_arrays | diff --git a/src/untyped_array.rs b/src/untyped_array.rs
index c51a8945..d70dfb5c 100644
--- a/src/untyped_array.rs
+++ b/src/untyped_array.rs
@@ -3,9 +3,11 @@
//! [ndarray]: https://numpy.org/doc/stable/reference/arrays.ndarray.html
use std::slice;
+#[cfg(feature = "gil-refs")]
+use pyo3::PyNativeType;
use pyo3::... | 1 | 4 | 1 |
d477a55961af39d4b78343ae81add97ad205b885 | Bas Schoenmaeckers | 2024-06-27T09:20:08 | Update sum_products | diff --git a/src/lib.rs b/src/lib.rs
index 44dc0962..e640d56d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -117,7 +117,7 @@ pub use crate::dtype::{
pub use crate::error::{BorrowError, FromVecError, NotContiguousError};
pub use crate::npyffi::{PY_ARRAY_API, PY_UFUNC_API};
pub use crate::strings::{PyFixedString, PyFixe... | 2 | 9 | 18 |
9c5d52eb8e727a60d5fc99f2f511ffc636fa9bbb | Bas Schoenmaeckers | 2024-06-27T09:18:55 | Update convert.rs | diff --git a/src/convert.rs b/src/convert.rs
index 4e50c512..342758d9 100644
--- a/src/convert.rs
+++ b/src/convert.rs
@@ -41,10 +41,7 @@ pub trait IntoPyArray: Sized {
type Dim: Dimension;
/// Deprecated form of [`IntoPyArray::into_pyarray_bound`]
- #[deprecated(
- since = "0.21.0",
- note... | 1 | 2 | 8 |
cd035047adf9d7147f22551d3580506df6f15f45 | Bas Schoenmaeckers | 2024-06-27T08:53:25 | Bumped pyo3 dependency to v0.22.0 | diff --git a/Cargo.toml b/Cargo.toml
index b634e872..650dc0ea 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,12 +22,16 @@ num-complex = ">= 0.2, < 0.5"
num-integer = "0.1"
num-traits = "0.2"
ndarray = ">= 0.15, < 0.17"
-pyo3 = { version = "0.21.0", default-features = false, features = ["macros"] }
+pyo3 = { version... | 4 | 10 | 5 |
c0373d26429c4833d302a32f4f0a0800c6ca41e5 | Magnus Ulimoen | 2024-10-04T11:09:08 | Drop support for ndarray<0.15 | diff --git a/Cargo.toml b/Cargo.toml
index 7d572d34..b634e872 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,7 +21,7 @@ nalgebra = { version = "0.32", default-features = false, optional = true }
num-complex = ">= 0.2, < 0.5"
num-integer = "0.1"
num-traits = "0.2"
-ndarray = ">= 0.13, < 0.17"
+ndarray = ">= 0.15, < ... | 1 | 1 | 1 |
80e483c73daf8198a18ded90905c9abab7390c54 | Magnus Ulimoen | 2024-08-21T07:25:50 | Lock ndarray version to 0.15.6 in example | diff --git a/examples/linalg/Cargo.lock b/examples/linalg/Cargo.lock
new file mode 100644
index 00000000..2ad2745c
--- /dev/null
+++ b/examples/linalg/Cargo.lock
@@ -0,0 +1,1115 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+# This file was tweaked since ndarray_linalg ... | 1 | 1,115 | 0 |
4d29b8093dbf1bfd2d9122cfa57b2e29c1942c25 | Magnus Ulimoen | 2024-08-20T10:56:19 | Allow deprecated ndarray function | diff --git a/Cargo.toml b/Cargo.toml
index b23bedbb..7d572d34 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,7 +21,7 @@ nalgebra = { version = "0.32", default-features = false, optional = true }
num-complex = ">= 0.2, < 0.5"
num-integer = "0.1"
num-traits = "0.2"
-ndarray = "0.16"
+ndarray = ">= 0.13, < 0.17"
pyo3... | 2 | 3 | 2 |
2f9ece473aea577ea905d842bb59546a97799a79 | Magnus Ulimoen | 2024-08-15T07:18:37 | Fix examples | diff --git a/examples/parallel/Cargo.toml b/examples/parallel/Cargo.toml
index e05f2e6b..d20d8bd2 100644
--- a/examples/parallel/Cargo.toml
+++ b/examples/parallel/Cargo.toml
@@ -11,7 +11,7 @@ crate-type = ["cdylib"]
[dependencies]
pyo3 = { version = "0.21.0", features = ["extension-module", "multiple-pymethods"] }
... | 2 | 2 | 2 |
e7ad8173ecbdbcccce3b78aecba2a5d71a0c902f | Magnus Ulimoen | 2024-08-15T07:18:22 | Replace deprecated method call | diff --git a/Cargo.toml b/Cargo.toml
index 7d572d34..b23bedbb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,7 +21,7 @@ nalgebra = { version = "0.32", default-features = false, optional = true }
num-complex = ">= 0.2, < 0.5"
num-integer = "0.1"
num-traits = "0.2"
-ndarray = ">= 0.13, < 0.17"
+ndarray = "0.16"
pyo3... | 2 | 2 | 2 |
290b04596e35b9ec4bf0dc442dce022892fd4ad5 | Magnus Ulimoen | 2024-08-12T08:50:10 | Support ndarray 0.16 | diff --git a/Cargo.toml b/Cargo.toml
index 38ebf742..7d572d34 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,7 +21,7 @@ nalgebra = { version = "0.32", default-features = false, optional = true }
num-complex = ">= 0.2, < 0.5"
num-integer = "0.1"
num-traits = "0.2"
-ndarray = ">= 0.13, < 0.16"
+ndarray = ">= 0.13, < ... | 1 | 1 | 1 |
bdc5ade6a008b1e8587733333fea1c1c3dfb6971 | Matthew Neeley | 2024-10-03T17:43:32 | Rename to _PyArray_DescrNumPy2 and _PyArray_LegacyDescr to match c code | diff --git a/src/npyffi/objects.rs b/src/npyffi/objects.rs
index 8f3ee56a..fa0fb403 100644
--- a/src/npyffi/objects.rs
+++ b/src/npyffi/objects.rs
@@ -59,7 +59,7 @@ pub struct PyArray_DescrProto {
#[repr(C)]
#[derive(Copy, Clone)]
-pub struct _PyArray_Descr_NumPy2 {
+pub struct _PyArray_DescrNumPy2 {
pub ob_ba... | 1 | 5 | 5 |
e781c7186bd421eb3ca9a5a3005b97ea9052b2d8 | Matthew Neeley | 2024-09-23T21:46:23 | Fix dtypes tests to work with numpy 1 or 2 | diff --git a/src/dtype.rs b/src/dtype.rs
index f6aeaac3..bc68dbaa 100644
--- a/src/dtype.rs
+++ b/src/dtype.rs
@@ -826,7 +826,7 @@ mod tests {
use pyo3::{py_run, types::PyTypeMethods};
- use crate::npyffi::NPY_NEEDS_PYAPI;
+ use crate::npyffi::{is_numpy_2, NPY_NEEDS_PYAPI};
#[test]
fn test_dt... | 1 | 6 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.