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
+5.6k PHP : Convert string to timestamp or datestamp before storing to database(MariaDB/MySQL)
+5.2k PHP : See installed compiled-in-modules
+7.1k Restart Apache or Nginx web server without password prompt
+6.8k Golang : Join lines with certain suffix symbol example
+10.2k Golang : How to profile or log time spend on execution?
+29.9k Golang : How to get HTTP request header information?
+7.9k Golang : Get today's weekday name and calculate target day distance example
+7.5k Golang : Shuffle strings array
+22.1k Golang : Repeat a character by multiple of x factor
+8.2k Android Studio : Rating bar example
+18.7k Unmarshal/Load CSV record into struct in Go
+10k CodeIgniter : Load different view for mobile devices