INNER CODE UNIT · Go

normalizeScalar

schollz/pake · pake.go:83

func normalizeScalar(k []byte) []byte {
	key := make([]byte, 32)
	if len(k) >= 32 {
		copy(key, k[:32])
	} else {
		copy(key[32-len(k):], k)
	}
	return key
}

// ed25519PointFromBigInts converts big.Int coordinates back to Edwards25519 point bytes
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)
	}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…