GithubHelp home page GithubHelp logo

go-goldilocks's Introduction

Go-goldilocks

Golang Ed448-Goldilocks bindings

How to use

func main() {
	testKey := "b93a28627cfa29fedb03c21aac0faa1ea0ba84c10cefa07c938f2e0adbf996f02c8d00e39695dfb6a0636c8bcb21645b06a869dfbbb489ef00"
	//golangHexEdKey := "6ada368e2799a55b9eb0e41e711d22af2569cf838656049635ba0ae4f344e180ce0e6b8f753df6d9de8aaf7ded0c8f61d93d4f29810098b780"
	//fmt.Println("Golang Ed Hex Key", golangHexEdKey)
	golangEdKey := common.Hex2Bytes(testKey)
	//fmt.Println("Golang Ed Key", golangEdKey)
	golangX448Key := EdPublicKeyToX448(BytesToPublicKey(golangEdKey))
	fmt.Println("Golang X448 Key", golangX448Key)
	fmt.Println("Golang X448 Hex Key", common.Bytes2Hex(golangX448Key[:]))
	golangPrivHexEdKey := "bd6cf469833692c5bf9bb68b8fdb9a0a4c70b01c2162eaceec3c669ccbdcabfe01eee57fe1ad942c98e840b4bf87ad05d3d5db9d794e029955"
	//fmt.Println("Golang Private Ed Hex Key", golangPrivHexEdKey)
	golangPrivEdKey := common.Hex2Bytes(golangPrivHexEdKey)
	//fmt.Println("Golang Private Ed Key", golangPrivEdKey)
	golangPrivX448Key := EdPrivateKeyToX448(BytesToPrivateKey(golangPrivEdKey))
	fmt.Println("Golang Private X448 Key", golangPrivX448Key)
	fmt.Println("Golang Private X448 Hex Key", common.Bytes2Hex(golangPrivX448Key[:]))
	sig := Ed448Sign(BytesToPrivateKey(golangPrivEdKey), BytesToPublicKey(golangEdKey), []byte{1}, []byte{1}, true)
	fmt.Println(sig)
	//sig[0] = 0x1
	fmt.Println("verify: ", Ed448Verify(BytesToPublicKey(golangEdKey), sig[:],  []byte{1}, []byte{1}, false))
	derivedKey := Ed448DerivePublicKey(BytesToPrivateKey(golangPrivEdKey))
	//fmt.Println("primary pub", golangHexEdKey)
	fmt.Println("derived", common.Bytes2Hex(derivedKey[:]))
	hash := sha3.NewLegacyKeccak512()
	timeB, err := time.Now().MarshalBinary()
	_, err = hash.Write(timeB)
	asd, err := Ed448GenerateKey(rand.Reader)
	fmt.Println(asd, "err", err, len(asd))
	asdd := Ed448DeriveSecret(BytesToPublicKey(golangEdKey), BytesToPrivateKey(golangPrivEdKey))
	fmt.Println(asdd)
	fmt.Println(len(asdd))
}

go-goldilocks's People

Contributors

error2215 avatar mojbaba avatar rastislavcore avatar sashazezulinsky avatar todesstille avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

0xgoerlimainnet

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.