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.

75 lines
1.6 KiB

  1. // Copyright 2020 ConsenSys Software Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // Code generated by consensys/gnark-crypto DO NOT EDIT
  15. package ffg
  16. // /!\ WARNING /!\
  17. // this code has not been audited and is provided as-is. In particular,
  18. // there is no security guarantees such as constant time implementation
  19. // or side-channel attack resistance
  20. // /!\ WARNING /!\
  21. // MulBy3 x *= 3
  22. func MulBy3(x *Element) {
  23. mulByConstant(x, 3)
  24. }
  25. // MulBy5 x *= 5
  26. func MulBy5(x *Element) {
  27. mulByConstant(x, 5)
  28. }
  29. // MulBy13 x *= 13
  30. func MulBy13(x *Element) {
  31. mulByConstant(x, 13)
  32. }
  33. // Butterfly sets
  34. // a = a + b
  35. // b = a - b
  36. func Butterfly(a, b *Element) {
  37. _butterflyGeneric(a, b)
  38. }
  39. func mul(z, x, y *Element) {
  40. _mulGeneric(z, x, y)
  41. }
  42. // FromMont converts z in place (i.e. mutates) from Montgomery to regular representation
  43. // sets and returns z = z * 1
  44. func fromMont(z *Element) {
  45. _fromMontGeneric(z)
  46. }
  47. func add(z, x, y *Element) {
  48. _addGeneric(z, x, y)
  49. }
  50. func double(z, x *Element) {
  51. _doubleGeneric(z, x)
  52. }
  53. func sub(z, x, y *Element) {
  54. _subGeneric(z, x, y)
  55. }
  56. func neg(z, x *Element) {
  57. _negGeneric(z, x)
  58. }
  59. func reduce(z *Element) {
  60. _reduceGeneric(z)
  61. }