本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
1000B

  1. // Copyright 2012 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Package curve25519 provides an implementation of scalar multiplication on
  5. // the elliptic curve known as curve25519. See http://cr.yp.to/ecdh.html
  6. package curve25519
  7. // basePoint is the x coordinate of the generator of the curve.
  8. var basePoint = [32]byte{9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
  9. // ScalarMult sets dst to the product in*base where dst and base are the x
  10. // coordinates of group points and all values are in little-endian form.
  11. func ScalarMult(dst, in, base *[32]byte) {
  12. scalarMult(dst, in, base)
  13. }
  14. // ScalarBaseMult sets dst to the product in*base where dst and base are the x
  15. // coordinates of group points, base is the standard generator and all values
  16. // are in little-endian form.
  17. func ScalarBaseMult(dst, in *[32]byte) {
  18. ScalarMult(dst, in, &basePoint)
  19. }
上海开阖软件有限公司 沪ICP备12045867号-1