-
Notifications
You must be signed in to change notification settings - Fork 27
/
interface.go
32 lines (27 loc) · 961 Bytes
/
interface.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
package crypto
// Hasher defines the functionality of a component able to generate hashes
type Hasher interface {
Sha256(data []byte) ([]byte, error)
Keccak256(data []byte) ([]byte, error)
Ripemd160(data []byte) ([]byte, error)
}
// BLS defines the functionality of a component able to verify BLS signatures
type BLS interface {
VerifyBLS(key []byte, msg []byte, sig []byte) error
}
// Ed25519 defines the functionality of a component able to verify Ed25519 signatures
type Ed25519 interface {
VerifyEd25519(key []byte, msg []byte, sig []byte) error
}
// Secp256k1 defines the functionality of a component able to verify and encode Secp256k1 signatures
type Secp256k1 interface {
VerifySecp256k1(key []byte, msg []byte, sig []byte, hashType uint8) error
EncodeSecp256k1DERSignature(r, s []byte) []byte
}
// VMCrypto will provide the interface to the main crypto functionalities of the vm
type VMCrypto interface {
Hasher
Ed25519
BLS
Secp256k1
}