Coder Social home page Coder Social logo

bwesterb / go-ristretto Goto Github PK

View Code? Open in Web Editor NEW
84.0 9.0 8.0 340 KB

Pure Go implementation of the Ristretto prime-order group over Edwards25519

Home Page: https://godoc.org/github.com/bwesterb/go-ristretto

License: MIT License

C 20.25% Go 78.01% Assembly 1.74%
ristretto golang curve25519 elligator prime-order-group edwards25519

go-ristretto's Issues

how to encode message into point on curve

@bwesterb Hi,bwesterb. I wanna implement Elgamal encryption with this library, but it confuses me that how to encode message into point on curve. Is there any sample for this usage. I saw the provided example, but it can not answer my need.

Looking forward to your reply.

Adding MulSub and SetReduced32

Would you like MulSub and SetReduced32 in go-ristretto?

MulSub would be identical to MulAdd and would just negate c0-c11

SetRedcued32 would take a 32 byte instead of a 64 byte array that SetReduced takes.

ScalarMult is broken?

Hey there, I think 0995efa might have broken ScalarMult (at least for me). Please see the following test case (scalar and result generated with curve25519-dalek) which passes before that commit.

func TestBasePoint(t *testing.T) {
	var buf [32]byte
	var s ristretto.Scalar
	var p1, p2, B ristretto.Point
	B.SetBase()

	tmp, _ := base64.StdEncoding.DecodeString("QekHbzmOtwUfRnheuyj1qyt8HN1WPjW4Jy199/2fQQ8=")
	copy(buf[:], tmp)
	s.SetBytes(&buf)

	tmp, _ = base64.StdEncoding.DecodeString("SqbtfZl5+A1RtHVfzN8HJCLUcC0Bz2kdThR7wRCUbCQ=")
	copy(buf[:], tmp)
	p1.SetBytes(&buf)

	p2.ScalarMult(&B, &s)

	if !p1.Equals(&p2) {
		t.Fatalf("[%v]B = %v != %v", s, p2, p1)
	}
}

The library is vartime on all non-amd64 platforms if built with go 1.12

FieldElement.Mul has a comment like thus: // TODO make sure we only use bits.Add64 if it's constant-time

While "the fallback code is vartime" has thankfully been fixed for Go 1.13 and later, the only platform where bits.Add64 is constant time for Go 1.12 series is amd64. With Go 1.13 the only platforms where both bits.Add64 and bits.Mul64 are fast is limited to amd64, arm64, and ppc64 (for both endian configurations), but at least they are guaranteed to be constant time now.

See:

Ristretto Point Compression

I just started using this lib and so far it's being an awesome experience! I'd like to ask about Ristretto point compression. Is there anyway of doing it? If not, is there any plans on implementing it? Is there anyway I could help with it? I can even make a pull request with the implementation if that's the case idk.

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.