INNER CODE UNIT · Go

ed25519PointFromBigInts

schollz/pake · pake.go:94

func ed25519PointFromBigInts(x, y *big.Int) []byte {
	// The point is stored entirely in x, y is ignored for Edwards25519
	bytes := make([]byte, 32)
	xBytes := x.Bytes()
	if len(xBytes) <= 32 {
		copy(bytes[32-len(xBytes):], xBytes)
	}
	return bytes
}

// ed25519PointToBigInts converts Edwards25519 point bytes to big.Int coordinates
func ed25519PointToBigInts(pointBytes []byte) (*big.Int, *big.Int) {
	if len(pointBytes) != 32 {
		return big.NewInt(0), big.NewInt(0)
	}
	// Store the entire point in x coordinate, y is always 0
	x := new(big.Int).SetBytes(pointBytes)
	y := big.NewInt(0)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…