github.com/igggame/nebulas-go@v2.1.0+incompatible/crypto/keystore/secp256k1/vrf/vrf_test.go (about) 1 // Copyright (C) 2018 go-nebulas 2 3 // 4 // This file is part of the go-nebulas library. 5 // 6 // the go-nebulas library is free software: you can redistribute it and/or modify 7 // it under the terms of the GNU General Public License as published by 8 // the Free Software Foundation, either version 3 of the License, or 9 // (at your option) any later version. 10 // 11 // the go-nebulas library is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 // 16 // You should have received a copy of the GNU General Public License 17 // along with the go-nebulas library. If not, see <http://www.gnu.org/licenses/>. 18 // 19 20 package vrf 21 22 import ( 23 "fmt" 24 "testing" 25 26 "github.com/nebulasio/go-nebulas/crypto" 27 "github.com/nebulasio/go-nebulas/crypto/keystore" 28 "github.com/nebulasio/go-nebulas/util/byteutils" 29 ) 30 31 const ( 32 // private key in hex 33 privKey = `b02b430d4a9d7120b65038452a6da3f3c716829e5be3665adf934d4798d96ed7` 34 // public key in hex 35 pubKey = `04e4d0dde330c0b8d8d8b1b2071aa75c3e94f200a3d11ca1d908644eee50c8833a816dc0b2d003fc66187ef6750a56e1b3004d32e6159008400ab92f2ded7b4544` 36 ) 37 38 func TestVRF(t *testing.T) { 39 priv, _ := crypto.NewPrivateKey(keystore.SECP256K1, nil) 40 seckey, err := priv.Encoded() 41 if err != nil { 42 t.Errorf("new priv err: %v", err) 43 } 44 seckeypub, err := priv.PublicKey().Encoded() 45 if err != nil { 46 t.Errorf("pub of new priv err: %v", err) 47 } 48 fmt.Println("1:", byteutils.Hex(seckey)) 49 fmt.Println("2:", byteutils.Hex(seckeypub)) 50 51 }