Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pbc-go
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Boston University PhD
IPFRE
pbc-go
Commits
e82f8ce1
Commit
e82f8ce1
authored
Feb 3, 2015
by
Nik
Browse files
Options
Downloads
Patches
Plain Diff
Added Then* methods, updated documentation
parent
c433515f
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
doc.go
+3
-2
3 additions, 2 deletions
doc.go
element.go
+8
-0
8 additions, 0 deletions
element.go
element_arith_simple.go
+64
-0
64 additions, 0 deletions
element_arith_simple.go
with
75 additions
and
2 deletions
doc.go
+
3
−
2
View file @
e82f8ce1
...
@@ -17,8 +17,9 @@
...
@@ -17,8 +17,9 @@
maximize performance.
maximize performance.
Since this library provides low-level access to pairing primitives, it is
Since this library provides low-level access to pairing primitives, it is
very easy to construct insecure systems. This library is intended to be used
very easy to accidentally construct insecure systems. This library is
by cryptographers or to implement well-analyzed cryptosystems.
intended to be used by cryptographers or to implement well-analyzed
cryptosystems.
Pairings
Pairings
...
...
This diff is collapsed.
Click to expand it.
element.go
+
8
−
0
View file @
e82f8ce1
...
@@ -25,6 +25,14 @@ import "runtime"
...
@@ -25,6 +25,14 @@ import "runtime"
//
//
// This assigns x = ((a+b)*c)^2.
// This assigns x = ((a+b)*c)^2.
//
//
// This technique is useful because it allows the target of operations to be
// different than the operands. However, several convenience functions have
// been provided to improve the readability of chained calls. These functions
// are of the form Then*, and implicitly specify the target as the first
// operand. The above example can be rewritten as:
//
// x.Add(a, b).ThenMul(c).ThenSquare()
//
// Whenever possible, the methods defined on Element use the same names as
// Whenever possible, the methods defined on Element use the same names as
// those in the math/big package.
// those in the math/big package.
//
//
...
...
This diff is collapsed.
Click to expand it.
element_arith_simple.go
0 → 100644
+
64
−
0
View file @
e82f8ce1
package
pbc
import
"math/big"
// ThenAdd is an alias for el.Add(el, y).
//
// Requirements:
// el and y must be from the same algebraic structure.
func
(
el
*
Element
)
ThenAdd
(
y
*
Element
)
*
Element
{
return
el
.
Add
(
el
,
y
)
}
// ThenSub is an alias for el.Sub(el, y).
//
// Requirements:
// el and y must be from the same algebraic structure.
func
(
el
*
Element
)
ThenSub
(
y
*
Element
)
*
Element
{
return
el
.
Sub
(
el
,
y
)
}
// ThenMul is an alias for el.Mul(el, y).
//
// Requirements:
// el and y must be from the same algebraic structure.
func
(
el
*
Element
)
ThenMul
(
y
*
Element
)
*
Element
{
return
el
.
Mul
(
el
,
y
)
}
// ThenMulBig is an alias for el.MulBig(el, i).
func
(
el
*
Element
)
ThenMulBig
(
i
*
big
.
Int
)
*
Element
{
return
el
.
MulBig
(
el
,
i
)
}
// ThenMulInt32 is an alias for el.MulInt32(el, i).
func
(
el
*
Element
)
ThenMulInt32
(
i
int32
)
*
Element
{
return
el
.
MulInt32
(
el
,
i
)
}
// ThenMulZn is an alias for el.MulZn(el, i).
//
// Requirements:
// i must be an element of an integer mod ring (e.g., Zn for some n).
func
(
el
*
Element
)
ThenMulZn
(
i
*
Element
)
*
Element
{
return
el
.
MulZn
(
el
,
i
)
}
// ThenDiv is an alias for el.Div(el, y).
//
// Requirements:
// el and y must be from the same algebraic structure.
func
(
el
*
Element
)
ThenDiv
(
y
*
Element
)
*
Element
{
return
el
.
Div
(
el
,
y
)
}
// ThenDouble is an alias for el.Double(el).
func
(
el
*
Element
)
ThenDouble
()
*
Element
{
return
el
.
Double
(
el
)
}
// ThenHalve is an alias for el.Halve(el).
func
(
el
*
Element
)
ThenHalve
()
*
Element
{
return
el
.
Halve
(
el
)
}
// ThenSquare is an alias for el.Square(el).
func
(
el
*
Element
)
ThenSquare
()
*
Element
{
return
el
.
Square
(
el
)
}
// ThenNeg is an alias for el.Neg(el).
func
(
el
*
Element
)
ThenNeg
()
*
Element
{
return
el
.
Neg
(
el
)
}
// ThenInvert is an alias for el.Invert(el).
func
(
el
*
Element
)
ThenInvert
()
*
Element
{
return
el
.
Invert
(
el
)
}
// ThenPowBig is an alias for el.PowBig(el, i).
func
(
el
*
Element
)
ThenPowBig
(
i
*
big
.
Int
)
*
Element
{
return
el
.
PowBig
(
el
,
i
)
}
// ThenPowZn is an alias for el.PowZn(el, i).
//
// Requirements:
// i must be an element of an integer mod ring (e.g., Zn for some n, typically
// the order of the algebraic structure that el lies in).
func
(
el
*
Element
)
ThenPowZn
(
i
*
Element
)
*
Element
{
return
el
.
PowZn
(
el
,
i
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment