diff options
author | Wei-Ning Huang <w@cobinhood.com> | 2018-09-21 15:06:38 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:48 +0800 |
commit | 4746deb69870907f9a18282b965ced372d1c0e98 (patch) | |
tree | 49e79ad34b315e3df8bb7555b4606e7c3e6240a5 /vendor/github.com/btcsuite/btcd/btcec | |
parent | f60070586cf462c2cf2de91911e5b34c8287da51 (diff) | |
download | go-tangerine-4746deb69870907f9a18282b965ced372d1c0e98.tar go-tangerine-4746deb69870907f9a18282b965ced372d1c0e98.tar.gz go-tangerine-4746deb69870907f9a18282b965ced372d1c0e98.tar.bz2 go-tangerine-4746deb69870907f9a18282b965ced372d1c0e98.tar.lz go-tangerine-4746deb69870907f9a18282b965ced372d1c0e98.tar.xz go-tangerine-4746deb69870907f9a18282b965ced372d1c0e98.tar.zst go-tangerine-4746deb69870907f9a18282b965ced372d1c0e98.zip |
dex: make geth buildable and update interface skeleton
Diffstat (limited to 'vendor/github.com/btcsuite/btcd/btcec')
-rw-r--r-- | vendor/github.com/btcsuite/btcd/btcec/genprecomps.go | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/vendor/github.com/btcsuite/btcd/btcec/genprecomps.go b/vendor/github.com/btcsuite/btcd/btcec/genprecomps.go new file mode 100644 index 000000000..d4a9c1b83 --- /dev/null +++ b/vendor/github.com/btcsuite/btcd/btcec/genprecomps.go @@ -0,0 +1,63 @@ +// Copyright 2015 The btcsuite developers +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +// This file is ignored during the regular build due to the following build tag. +// It is called by go generate and used to automatically generate pre-computed +// tables used to accelerate operations. +// +build ignore + +package main + +import ( + "bytes" + "compress/zlib" + "encoding/base64" + "fmt" + "log" + "os" + + "github.com/btcsuite/btcd/btcec" +) + +func main() { + fi, err := os.Create("secp256k1.go") + if err != nil { + log.Fatal(err) + } + defer fi.Close() + + // Compress the serialized byte points. + serialized := btcec.S256().SerializedBytePoints() + var compressed bytes.Buffer + w := zlib.NewWriter(&compressed) + if _, err := w.Write(serialized); err != nil { + fmt.Println(err) + os.Exit(1) + } + w.Close() + + // Encode the compressed byte points with base64. + encoded := make([]byte, base64.StdEncoding.EncodedLen(compressed.Len())) + base64.StdEncoding.Encode(encoded, compressed.Bytes()) + + fmt.Fprintln(fi, "// Copyright (c) 2015 The btcsuite developers") + fmt.Fprintln(fi, "// Use of this source code is governed by an ISC") + fmt.Fprintln(fi, "// license that can be found in the LICENSE file.") + fmt.Fprintln(fi) + fmt.Fprintln(fi, "package btcec") + fmt.Fprintln(fi) + fmt.Fprintln(fi, "// Auto-generated file (see genprecomps.go)") + fmt.Fprintln(fi, "// DO NOT EDIT") + fmt.Fprintln(fi) + fmt.Fprintf(fi, "var secp256k1BytePoints = %q\n", string(encoded)) + + a1, b1, a2, b2 := btcec.S256().EndomorphismVectors() + fmt.Println("The following values are the computed linearly " + + "independent vectors needed to make use of the secp256k1 " + + "endomorphism:") + fmt.Printf("a1: %x\n", a1) + fmt.Printf("b1: %x\n", b1) + fmt.Printf("a2: %x\n", a2) + fmt.Printf("b2: %x\n", b2) +} |