Golang crypto/elliptic.Marshal() function example
package crypto/elliptic
Marshal converts a point into the form specified in section 4.3.6 of ANSI X9.62.
Golang crypto/elliptic.Marshal() function usage example
var err error
var priv []byte
var x, y *big.Int
priv, x, y, err = elliptic.GenerateKey(elliptic.P224(), rand.Reader) //P224 for this example
if err != nil {
fmt.Println(err)
}
var marshaled []byte
marshaled = elliptic.Marshal(elliptic.P224(), x, y)
fmt.Println(marshaled)
Sample output :
[4 8 194 215 80 109 174 39 147 176 75 132 153 56 13 142 65 43 90 211 142 66 39 215 114 140 172 36 33 185 113 173 67 83 22 137 109 51 136 241 119 204 196 5 95 255 67 254 200 1 87 23 101 173 58 214 49]
Reference :
See also : Golang crypto/elliptic.GenerateKey() function example
Advertisement
Something interesting
Tutorials
+12.2k Golang : Detect user location with HTML5 geo-location
+6.8k Golang : Muxing with Martini example
+25.3k Golang : Get current file path of a file or executable
+4.7k MariaDB/MySQL : Form select statement or search query with Chinese characters
+13k Golang : Get terminal width and height example
+20.9k Golang : Underscore or snake_case to camel case example
+15.7k Golang : Intercept Ctrl-C interrupt or kill signal and determine the signal type
+23k Golang : Calculate time different
+7.4k Golang : Example of custom handler for Gorilla's Path usage.
+30.9k error: trying to remove "yum", which is protected
+20.8k Golang : Convert date string to variants of time.Time type examples
+5.7k Golang : Struct field tags and what is their purpose?