github.com/consensys/gnark-crypto@v0.14.0/ecc/bw6-756/internal/fptower/frobenius.go (about) 1 // Copyright 2020 ConsenSys AG 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 15 package fptower 16 17 import "github.com/consensys/gnark-crypto/ecc/bw6-756/fp" 18 19 var _frobA = fp.Element{ 20 4513305906938863657, 21 16223881110415437916, 22 2594807996890465129, 23 12027263585750947831, 24 4394688080420790544, 25 16545365607090591069, 26 17206939158340345469, 27 16693218895653628888, 28 12341936222077983834, 29 15961798706098381578, 30 6325965824540199947, 31 854909948470066, 32 } 33 var _frobB = fp.Element{ 34 13933438166770692198, 35 9936849508207988643, 36 15731274946730933551, 37 17453539207763286666, 38 9211229669332609391, 39 16304457798847396452, 40 9530634072302290725, 41 16589137634438497937, 42 3757329544587311773, 43 6048657743386074056, 44 539268601340212626, 45 3128351770947469, 46 } 47 var _frobC = fp.Element{ 48 4513305906938859419, 49 12241098542315434076, 50 17754824365858099600, 51 5821813791745674579, 52 7115107423905013045, 53 2898523548767316962, 54 7403683460125356932, 55 16613279480632639560, 56 14397298621774850312, 57 623298467364696769, 58 15794181680107729725, 59 1224261424482813, 60 } 61 var _frobAC = fp.Element{ 62 4239, 63 7713986544913874944, 64 18326082943621398681, 65 11034058719804682881, 66 13605917749753399936, 67 14403079332228435905, 68 8290829156933084579, 69 14835612456382575210, 70 16099265766665295608, 71 3563712375774904018, 72 6865234425880412574, 73 3983261719417535, 74 } 75 var _frobBC = fp.Element{ 76 13933438166770687960, 77 5954066940107984803, 78 12444547241989016406, 79 11248089413758013415, 80 11931649012816831892, 81 2657615740524122345, 82 18174122447796853804, 83 16509198219417508608, 84 5812691944284178251, 85 9156901578361940863, 86 10007484456907742403, 87 3497703246960216, 88 } 89 90 // Frobenius set z in E6 to Frobenius(x), return z 91 func (z *E6) Frobenius(x *E6) *E6 { 92 93 z.B0.A0 = x.B0.A0 94 z.B0.A1.Mul(&x.B0.A1, &_frobA) 95 z.B0.A2.Mul(&x.B0.A2, &_frobB) 96 97 z.B1.A0.Mul(&x.B1.A0, &_frobC) 98 z.B1.A1.Mul(&x.B1.A1, &_frobAC) 99 z.B1.A2.Mul(&x.B1.A2, &_frobBC) 100 101 return z 102 }