Let to pass an arbitrary number of cyphers to PublicKey.Add #5

Merged
pdyraga merged 5 commits from master into master 2018-07-03 18:53:09 -04:00
pdyraga commented 2018-06-28 10:03:26 -04:00 (Migrated from github.com)

PublicKey.Add accepts now an arbitrary number of *Cyphers. Previously, it was possible to add only two *Cypher instances and it was quite unwieldy for a lot of use cases.

The current implementation is backward compatible. It's still possible to pass just two *Cypher arguments, so every project referencing the library will observe no compilation issues.

// backward-compatibility
cypherA := privateKey.Add(cypher1, cypher2)

// you can pass any number of cyphers now
cypherB := privateKey.Add(cypher1, cypher2, cypher3, cypher4)

// or even a slice of them
cyphers := []*Cypher{cypher1, cypher2, cypher3, cypher4}
cypherC := privateKey.Add(cyphers...)

The original PR: https://github.com/keep-network/paillier/pull/5

`PublicKey.Add` accepts now an arbitrary number of `*Cypher`s. Previously, it was possible to add only two `*Cypher` instances and it was quite unwieldy for a lot of use cases. The current implementation is backward compatible. It's still possible to pass just two `*Cypher` arguments, so every project referencing the library will observe no compilation issues. ``` // backward-compatibility cypherA := privateKey.Add(cypher1, cypher2) // you can pass any number of cyphers now cypherB := privateKey.Add(cypher1, cypher2, cypher3, cypher4) // or even a slice of them cyphers := []*Cypher{cypher1, cypher2, cypher3, cypher4} cypherC := privateKey.Add(cyphers...) ``` The original PR: https://github.com/keep-network/paillier/pull/5
didiercrunch commented 2018-07-03 18:53:32 -04:00 (Migrated from github.com)

Thousand thanks for that one. Sorry for delay, I forgot about it.

cheers,

didier

Thousand thanks for that one. Sorry for delay, I forgot about it. cheers, didier
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: didier/paillier#5