herumi / bls

288 stars 132 forks source link

How to perform point subtraction and negation on BLS curve? #76

Closed Qiao-Jin closed 2 years ago

Qiao-Jin commented 2 years ago

Hello! I'm curious how to perform point subtraction and negation on BLS curve. I.e there are two signatures A and B, how to perform point subtraction & negation such as A - B, -B, etc in this repo? Thx!


I observed that this func might be used for signature subtraction:

https://github.com/herumi/bls/blob/3f3850a6eac71e1ce31b4a3d9b85aa7af2a2d08e/src/bls_c_impl.hpp#L859

Could you please include this func into https://github.com/herumi/bls/blob/master/ffi/cs/bls.cs? Thx!

Qiao-Jin commented 2 years ago

@herumi

herumi commented 2 years ago

Do you want the function from C#?

Qiao-Jin commented 2 years ago

Do you want the function from C#?

Yes, it's needed for subtraction between signatures

herumi commented 2 years ago

Okay, I'll append it. Please wait a moment.

Qiao-Jin commented 2 years ago

Okay, I'll append it. Please wait a moment.

Thx so much!

herumi commented 2 years ago

I added sub methods. https://github.com/herumi/bls/commit/98140f3d8efe2d7b99ca971461a0a99d08304903

Though neg(X) can be achieved using sub(zero, X), do you need neg?

Qiao-Jin commented 2 years ago

I added sub methods. 98140f3

Though neg(X) can be achieved using sub(zero, X), do you need neg?

I think that should be enough, thx! By the way, if B = 3A, is there a way to get A from B?

herumi commented 2 years ago

What are the types of A and B?

Qiao-Jin commented 2 years ago

What are the types of A and B?

They are signatures

herumi commented 2 years ago

I'm sorry for the late response. I added them about one month ago.