From 08142fe1540e161908af87a11e442b301d88998a Mon Sep 17 00:00:00 2001 From: bytemare <3641580+bytemare@users.noreply.github.com> Date: Thu, 3 Oct 2024 11:40:48 +0200 Subject: [PATCH] update signatures and package Signed-off-by: bytemare <3641580+bytemare@users.noreply.github.com> --- element.go | 7 +++---- groups.go | 22 +++++++++++----------- scalar.go | 13 ++++++------- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/element.go b/element.go index 6b37af8..2a30be2 100644 --- a/element.go +++ b/element.go @@ -1,19 +1,18 @@ // SPDX-License-Identifier: MIT // -// Copyright (C) 2020-2023 Daniel Bourdrez. All Rights Reserved. +// Copyright (C) 2020-2024 Daniel Bourdrez. All Rights Reserved. // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree or at // https://spdx.org/licenses/MIT.html -// Package crypto exposes a prime-order elliptic curve groups with additional hash-to-curve operations. -package crypto +package ecc import ( "fmt" "strings" - "github.com/bytemare/crypto/internal" + "github.com/bytemare/ecc/internal" ) // Element represents an element on the curve of the prime-order group. diff --git a/groups.go b/groups.go index c84ce33..90098fc 100644 --- a/groups.go +++ b/groups.go @@ -1,16 +1,16 @@ // SPDX-License-Group: MIT // -// Copyright (C) 2020-2023 Daniel Bourdrez. All Rights Reserved. +// Copyright (C) 2020-2024 Daniel Bourdrez. All Rights Reserved. // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree or at // https://spdx.org/licenses/MIT.html -// Package crypto exposes a prime-order elliptic curve groups with additional hash-to-curve operations. +// Package ecc exposes a prime-order elliptic curve groups with additional hash-to-curve operations. // // It implements the latest hash-to-curve specification to date // (https://datatracker.ietf.org/doc/draft-irtf-cfrg-hash-to-curve/). -package crypto +package ecc import ( "crypto" @@ -18,11 +18,11 @@ import ( "fmt" "sync" - "github.com/bytemare/crypto/internal" - "github.com/bytemare/crypto/internal/edwards25519" - "github.com/bytemare/crypto/internal/nist" - "github.com/bytemare/crypto/internal/ristretto" - "github.com/bytemare/crypto/internal/secp256k1" + "github.com/bytemare/ecc/internal" + "github.com/bytemare/ecc/internal/edwards25519" + "github.com/bytemare/ecc/internal/nist" + "github.com/bytemare/ecc/internal/ristretto" + "github.com/bytemare/ecc/internal/secp256k1" ) // Group identifies prime-order groups over elliptic curves with hash-to-group operations. @@ -47,8 +47,8 @@ const ( // Edwards25519Sha512 identifies the Edwards25519 group with SHA2-512 hash-to-group hashing. Edwards25519Sha512 - // Secp256k1 identifies the SECp256k1 group with SHA2-256 hash-to-group hashing. - Secp256k1 + // Secp256k1Sha256 identifies the SECp256k1 group with SHA2-256 hash-to-group hashing. + Secp256k1Sha256 maxID @@ -171,7 +171,7 @@ func (g Group) init() { g.initGroup(nist.P521) case Edwards25519Sha512: g.initGroup(edwards25519.New) - case Secp256k1: + case Secp256k1Sha256: g.initGroup(secp256k1.New) default: panic("group not recognized") diff --git a/scalar.go b/scalar.go index 72d2949..cd3c717 100644 --- a/scalar.go +++ b/scalar.go @@ -1,19 +1,18 @@ // SPDX-License-Identifier: MIT // -// Copyright (C) 2020-2023 Daniel Bourdrez. All Rights Reserved. +// Copyright (C) 2020-2024 Daniel Bourdrez. All Rights Reserved. // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree or at // https://spdx.org/licenses/MIT.html -// Package crypto exposes a prime-order elliptic curve groups with additional hash-to-curve operations. -package crypto +package ecc import ( "fmt" "strings" - "github.com/bytemare/crypto/internal" + "github.com/bytemare/ecc/internal" ) // Scalar represents a scalar in the prime-order group. @@ -116,12 +115,12 @@ func (s *Scalar) Equal(scalar *Scalar) bool { } // LessOrEqual returns 1 if s <= scalar, and 0 otherwise. -func (s *Scalar) LessOrEqual(scalar *Scalar) int { +func (s *Scalar) LessOrEqual(scalar *Scalar) bool { if scalar == nil { - return 0 + return false } - return s.Scalar.LessOrEqual(scalar.Scalar) + return s.Scalar.LessOrEqual(scalar.Scalar) == 1 } // IsZero returns whether the scalar is 0.