Skip to content
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

feat: add bls12381 #1

Merged
merged 5 commits into from
Mar 12, 2024
Merged

feat: add bls12381 #1

merged 5 commits into from
Mar 12, 2024

Conversation

tac0turtle
Copy link
Member

@tac0turtle tac0turtle commented Mar 8, 2024

This pr adds bls12381 to a curves pkg in order to be reused by comet and Cosmos SDK


func init() {
// Reserve 1 core for general application work
maxProcs := runtime.GOMAXPROCS(0) - 1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uber go maxprocs is good here

@tac0turtle tac0turtle changed the base branch from main to curves March 11, 2024 10:01
func RandKey() (SecretKey, error) {
// Generate 32 bytes of randomness
var ikm [32]byte
_, err := rand.NewGenerator().Read(ikm[:])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can one liner this

}

func (s *bls12SecretKey) Sign(msg []byte) SignatureI {
signature := new(blstSignature).Sign(s.p, msg, dst)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can 1 liner


// Marshal a secret key into a LittleEndian byte slice.
func (s *bls12SecretKey) Marshal() []byte {
keyBytes := s.p.Serialize()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 liner


// bls12SecretKey used in the BLS signature scheme.
type bls12SecretKey struct {
p *blst.SecretKey

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a downside to embedding this?

@tac0turtle tac0turtle merged commit 740e2ab into curves Mar 12, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants