github.com/consensys/gnark-crypto@v0.14.0/ecc/bls24-315/fr/mimc/options.go (about) 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 15 // Code generated by consensys/gnark-crypto DO NOT EDIT 16 17 package mimc 18 19 import ( 20 "github.com/consensys/gnark-crypto/ecc/bls24-315/fr" 21 ) 22 23 // Option defines option for altering the behavior of the MiMC hasher. 24 // See the descriptions of functions returning instances of this type for 25 // particular options. 26 type Option func(*mimcConfig) 27 28 type mimcConfig struct { 29 byteOrder fr.ByteOrder 30 } 31 32 // default options 33 func mimcOptions(opts ...Option) mimcConfig { 34 // apply options 35 opt := mimcConfig{ 36 byteOrder: fr.BigEndian, 37 } 38 for _, option := range opts { 39 option(&opt) 40 } 41 return opt 42 } 43 44 // WithByteOrder sets the byte order used to decode the input 45 // in the Write method. Default is BigEndian. 46 func WithByteOrder(byteOrder fr.ByteOrder) Option { 47 return func(opt *mimcConfig) { 48 opt.byteOrder = byteOrder 49 } 50 }