mirror of
https://github.com/arnaucube/cryptofun.git
synced 2026-02-28 13:26:40 +01:00
bn128 finite fields operations
This commit is contained in:
17
utils/utils.go
Normal file
17
utils/utils.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user