-
Notifications
You must be signed in to change notification settings - Fork 1
/
group.go
46 lines (35 loc) · 1.63 KB
/
group.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// SPDX-License-Identifier: MIT
//
// Copyright (C) 2021 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 internal defines simple and abstract APIs to group Elements and Scalars.
package internal
// Group abstracts operations in a prime-order group.
type Group interface {
// NewScalar returns a new scalar set to 0.
NewScalar() Scalar
// NewElement returns the identity element (point at infinity).
NewElement() Element
// Base returns the group's base point a.k.a. canonical generator.
Base() Element
// HashToScalar returns a safe mapping of the arbitrary input to a Scalar.
// The DST must not be empty or nil, and is recommended to be longer than 16 bytes.
HashToScalar(input, dst []byte) Scalar
// HashToGroup returns a safe mapping of the arbitrary input to an Element in the Group.
// The DST must not be empty or nil, and is recommended to be longer than 16 bytes.
HashToGroup(input, dst []byte) Element
// EncodeToGroup returns a non-uniform mapping of the arbitrary input to an Element in the Group.
// The DST must not be empty or nil, and is recommended to be longer than 16 bytes.
EncodeToGroup(input, dst []byte) Element
// Ciphersuite returns the hash-to-curve ciphersuite identifier.
Ciphersuite() string
// ScalarLength returns the byte size of an encoded scalar.
ScalarLength() int
// ElementLength returns the byte size of an encoded element.
ElementLength() int
// Order returns the order of the canonical group of scalars.
Order() string
}