Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help to replicate go code in lisp

58 views
Skip to first unread message

Bela Pecsek

unread,
Dec 31, 2021, 5:06:29 AM12/31/21
to
I have just started learning ironclad and would like to convert a small go code to Common Lisp to benchmark the speed but I am struggling to make it work.

How would I do it?

package main

import ("fmt" "os" "strconv" "github.com/ethereum/go-ethereum/crypto/secp256k1")

func main() {
n := 1
if len(os.Args) > 1 {
var err error
n, err = strconv.Atoi(os.Args[1])
_ = err
}

privateKey := []byte{45, 238, 146, 112, 121, 40, 60, 60, 79, 202, 62, 249, 112, 255, 77, 56, 182, 69, 146, 227, 254, 10, 176, 218, 217, 19, 45, 112, 181, 188, 118, 147}

curve := secp256k1.S256()
px := curve.Gx
py := curve.Gy
for _i := 0; _i < n; _i++ {
px, py = curve.ScalarMult(px, py, privateKey)
}

fmt.Printf("%x,%x\n", px, py)
}

Bela Pecsek

unread,
Dec 31, 2021, 6:03:50 AM12/31/21
to
I've forgotten to mention that this should be the result for n=10
a6f7cbeb7125279820188fd73631f14e11789c665362b2f7464f53eb041d2329,3ed07e8738690958d8089d6dd7efdeda5dd9e9c9d8446513e42a17d3c553db49

Tom Russ

unread,
Dec 31, 2021, 8:26:19 PM12/31/21
to
On Friday, December 31, 2021 at 3:03:50 AM UTC-8, bela....@gmail.com wrote:
> On Friday, December 31, 2021 at 11:06:29 AM UTC+1, Bela Pecsek wrote:
> > I have just started learning ironclad and would like to convert a small go code to Common Lisp to benchmark the speed but I am struggling to make it work.
> >
> > How would I do it?
> >
> > package main
> >
> > import ("fmt" "os" "strconv" "github.com/ethereum/go-ethereum/crypto/secp256k1")

This Github link returns a 404 error.
That makes it very difficult to figure out what secp256k1.S256() and its associated methods Gx, Gy and ScalarMult do.

Bela Pecsek

unread,
Jan 1, 2022, 12:42:17 PM1/1/22
to
Sorry about this. Please note that this is not my code.

The code actually compiles without problem.

The github repo I thing is here
https://github.com/ethereum/go-ethereum/tree/master/crypto/secp256k1
0 new messages