Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for SetCanonicalBytes (0.18 sec)

  1. src/crypto/internal/edwards25519/scalar_test.go

    	}
    
    	b := scalarMinusOneBytes
    	b[31] += 1
    	s := scOne
    	if out, err := s.SetCanonicalBytes(b[:]); err == nil {
    		t.Errorf("SetCanonicalBytes worked on a non-canonical value")
    	} else if s != scOne {
    		t.Errorf("SetCanonicalBytes modified its receiver")
    	} else if out != nil {
    		t.Errorf("SetCanonicalBytes did not return nil with an error")
    	}
    }
    
    func TestScalarSetUniformBytes(t *testing.T) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 28 17:26:17 UTC 2023
    - 7.6K bytes
    - Viewed (0)
  2. src/crypto/internal/edwards25519/scalarmult_test.go

    // license that can be found in the LICENSE file.
    
    package edwards25519
    
    import (
    	"testing"
    	"testing/quick"
    )
    
    var (
    	// a random scalar generated using dalek.
    	dalekScalar, _ = (&Scalar{}).SetCanonicalBytes([]byte{219, 106, 114, 9, 174, 249, 155, 89, 69, 203, 201, 93, 92, 116, 234, 187, 78, 115, 103, 172, 182, 98, 62, 103, 187, 136, 13, 100, 248, 110, 12, 4})
    	// the above, times the edwards25519 basepoint.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 28 17:26:17 UTC 2023
    - 4.9K bytes
    - Viewed (0)
  3. src/crypto/internal/edwards25519/scalar.go

    	fiatScalarToMontgomery(&s.s, (*fiatScalarNonMontgomeryDomainFieldElement)(&s.s))
    	return s
    }
    
    // SetCanonicalBytes sets s = x, where x is a 32-byte little-endian encoding of
    // s, and returns s. If x is not a canonical encoding of s, SetCanonicalBytes
    // returns nil and an error, and the receiver is unchanged.
    func (s *Scalar) SetCanonicalBytes(x []byte) (*Scalar, error) {
    	if len(x) != 32 {
    		return nil, errors.New("invalid scalar length")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 18:57:38 UTC 2024
    - 10.8K bytes
    - Viewed (0)
  4. src/crypto/ed25519/ed25519.go

    	k, err := edwards25519.NewScalar().SetUniformBytes(hramDigest)
    	if err != nil {
    		panic("ed25519: internal error: setting scalar failed")
    	}
    
    	S, err := edwards25519.NewScalar().SetCanonicalBytes(sig[32:])
    	if err != nil {
    		return false
    	}
    
    	// [S]B = R + [k]A --> [k](-A) + [S]B = R
    	minusA := (&edwards25519.Point{}).Negate(A)
    	R := (&edwards25519.Point{}).VarTimeDoubleScalarBaseMult(k, minusA, S)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:11:18 UTC 2024
    - 11.7K bytes
    - Viewed (0)
Back to top