-
Notifications
You must be signed in to change notification settings - Fork 52
Primality testing #67
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Lovesh <lovesh.harchandani@evernym.com>
Signed-off-by: Lovesh <lovesh.harchandani@evernym.com>
Signed-off-by: Lovesh <lovesh.harchandani@evernym.com>
use std::slice; | ||
|
||
#[no_mangle] | ||
pub extern fn indy_crypto_primality_check(big_endian_number: *const u8, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to ask for some changes to follow design and code structure. I believe we need to add is_prime method to BN entity instead of providing static non-entity related call. Now you provides different Rust API and FFI API.
It will allow to expose big nums in more clean and re-usable way. FFI API can look like this:
let bn = null;
ind_crypto_bn_new(bytes, &bn)
let is_prime = indy_crypto_bn_is_prime(bn)
indy_crypto_free(bn)
it will later allow to expose complete big nums API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same needs to be added to python wrapper. Just follow the same entity model as Rust API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add is_prime
to which BN
entity?
FFI wrapper for is_prime method, update to the python wrapper