bn128 finite fields operations

This commit is contained in:
arnaucube
2018-10-07 00:16:23 +02:00
parent 4acca94c9e
commit 151ca78806
14 changed files with 712 additions and 54 deletions

17
utils/utils.go Normal file
View File

@@ -0,0 +1,17 @@
package utils
import "encoding/hex"
// BytesToHex converts from an array of bytes to a hex encoded string
func BytesToHex(bytesArray []byte) string {
r := "0x"
h := hex.EncodeToString(bytesArray)
r = r + h
return r
}
// HexToBytes converts from a hex string into an array of bytes
func HexToBytes(h string) ([]byte, error) {
b, err := hex.DecodeString(h[2:])
return b, err
}