Skip to content
This repository was archived by the owner on Jun 8, 2020. It is now read-only.

Primality testing#67

Open
lovesh wants to merge 10 commits into
hyperledger-indy:masterfrom
lovesh:primality
Open

Primality testing#67
lovesh wants to merge 10 commits into
hyperledger-indy:masterfrom
lovesh:primality

Conversation

@lovesh

@lovesh lovesh commented Feb 7, 2018

Copy link
Copy Markdown
Contributor

FFI wrapper for is_prime method, update to the python wrapper

Lovesh and others added 8 commits February 6, 2018 00:04
Signed-off-by: Lovesh <lovesh.harchandani@evernym.com>
Signed-off-by: Lovesh <lovesh.harchandani@evernym.com>
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,

Copy link
Copy Markdown
Contributor

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

@vimmerru vimmerru Feb 8, 2018

Copy link
Copy Markdown
Contributor

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.

@lovesh lovesh Feb 8, 2018

Copy link
Copy Markdown
Contributor Author

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants