ConfidentialLCA/template/Program-Templates/SuppChainAgg/SuppChainAgg.mpc-template

52 lines
1.4 KiB
Plaintext
Executable File

#############################################################################
# Copyright (c) 2019-2021 University of Exeter, UK
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#############################################################################
numEnvFl=$numEnvFl
enFlValues=Array(numEnvFl,sint)
enFlName=[$enFlName]
scaleVector=Array($companyNumber,sint)
def GetFlows():
companyNumber=$companyNumber
for n in range(companyNumber):
# gets the values of scale vector as secret
scaleVector[n]=sint.get_private_input_from(0)
for i in range(companyNumber):
for j in range(numEnvFl):
if_then(enFlValues[j].reveal!=0)
enFlValues[j]+=(sint.get_private_input_from(i)*scaleVector[i])
else_then()
enFlValues[j]=(sint.get_private_input_from(i)*scaleVector[i])
end_if()
GetFlows()
for k in range(numEnvFl):
enFlValues[k].reveal_to(0)