mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-04 10:21:40 +00:00
(no commit message provided)
This commit is contained in:
committed by
Prad Nukala (aider)
parent
5fd43dfd6b
commit
2f976209db
@@ -1,27 +0,0 @@
|
||||
//
|
||||
// Copyright Coinbase, Inc. All Rights Reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
package frost
|
||||
|
||||
import (
|
||||
"crypto/sha512"
|
||||
|
||||
"github.com/onsonr/hway/crypto/core/curves"
|
||||
)
|
||||
|
||||
type ChallengeDerive interface {
|
||||
DeriveChallenge(msg []byte, pubKey curves.Point, r curves.Point) (curves.Scalar, error)
|
||||
}
|
||||
|
||||
type Ed25519ChallengeDeriver struct{}
|
||||
|
||||
func (ed Ed25519ChallengeDeriver) DeriveChallenge(msg []byte, pubKey curves.Point, r curves.Point) (curves.Scalar, error) {
|
||||
h := sha512.New()
|
||||
_, _ = h.Write(r.ToAffineCompressed())
|
||||
_, _ = h.Write(pubKey.ToAffineCompressed())
|
||||
_, _ = h.Write(msg)
|
||||
return new(curves.ScalarEd25519).SetBytesWide(h.Sum(nil))
|
||||
}
|
||||
Reference in New Issue
Block a user