-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
updated noble curves for point fix #42
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cc8db8b
updated noble curves for point fix
CluEleSsUK 7ea6e83
migrate old bls12-381 lib to a new one
CluEleSsUK b3c637c
correct the version
CluEleSsUK b82159d
added some comments
CluEleSsUK 4599e22
pinned noble curves version
CluEleSsUK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import * as mod from "@noble/curves/abstract/modular" | ||
|
||
// these are all some helpers around the field elements used in the BLS lib that got abstracted away | ||
// when migrating from @noble/bls12-381 -> @noble/curves | ||
declare const Fp: Readonly<mod.IField<bigint> & Required<Pick<mod.IField<bigint>, "isOdd">>>; | ||
type Fp = bigint; | ||
type BigintTuple = [bigint, bigint]; | ||
type Fp2 = { | ||
c0: bigint; | ||
c1: bigint; | ||
}; | ||
|
||
function fp2FromBigTuple(t: BigintTuple): Fp2 { | ||
return { | ||
c0: t[0], | ||
c1: t[1] | ||
} | ||
} | ||
|
||
declare const Fp2: mod.IField<Fp2> | ||
type BigintSix = [bigint, bigint, bigint, bigint, bigint, bigint] | ||
type Fp6 = { | ||
c0: Fp2; | ||
c1: Fp2; | ||
c2: Fp2; | ||
}; | ||
|
||
declare const Fp6: mod.IField<Fp6> | ||
|
||
function fp6FromBigSix(b: BigintSix): Fp6 { | ||
return { | ||
c0: { | ||
c0: b[0], | ||
c1: b[1], | ||
}, | ||
c1: { | ||
c0: b[2], | ||
c1: b[3], | ||
}, | ||
c2: { | ||
c0: b[4], | ||
c1: b[5], | ||
} | ||
} | ||
} | ||
|
||
type Fp12 = { | ||
c0: Fp6; | ||
c1: Fp6; | ||
}; | ||
type BigintTwelve = [ | ||
bigint, | ||
bigint, | ||
bigint, | ||
bigint, | ||
bigint, | ||
bigint, | ||
bigint, | ||
bigint, | ||
bigint, | ||
bigint, | ||
bigint, | ||
bigint | ||
]; | ||
|
||
function fp12FromBigTwelve(b: BigintTwelve): Fp12 { | ||
return { | ||
c0: { | ||
c0: { | ||
c0: b[0], | ||
c1: b[1], | ||
}, | ||
c1: { | ||
c0: b[2], | ||
c1: b[3], | ||
}, | ||
c2: { | ||
c0: b[4], | ||
c1: b[5], | ||
} | ||
}, | ||
c1: { | ||
c0: { | ||
c0: b[6], | ||
c1: b[7], | ||
}, | ||
c1: { | ||
c0: b[8], | ||
c1: b[9], | ||
}, | ||
c2: { | ||
c0: b[10], | ||
c1: b[11], | ||
} | ||
} | ||
} | ||
} | ||
|
||
export {Fp, Fp2, Fp6, Fp12, fp2FromBigTuple, fp6FromBigSix, fp12FromBigTwelve, BigintTwelve} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
No
noble/curves
in here?