Wireless Communications and Mobile Computing / 2018 / Article / Alg 1

Research Article

A Secure and Scalable Data Communication Scheme in Smart Grids

Algorithm 1

Boolean formula 2LSSS .
(1) Let , which represents the root of .
(2) Let , which is a counter for the converting process.
(3) is the LSSS matrix, initialized to null; () is the function that maps the rows of to attributes.
(4) BooleanFormula2LSSS(root(),, , , );
(5) function  (BooleanFormula2LSSS
(6)   if   is an AND gate then
(7)    pad    with 0’s (if necessary) to make its length ;
(8)    label the left child with the vector , where means concatenation;
(9)    label the right child with the vector , where denotes the zero vector of length ;
(10)    ;
(11)    is an OR gate then
(12)    label the left child and the right child with the vector ;
(13)   end if
(14)   for  ’s child node as   do
(15)    if   is an attribute then
(16)     .push; // add to the end of matrix
(17)     add the mapping ;
(18)    else
(19)     BooleanFormula2LSSS(,, , , )
(20)    end if
(21)   end for
(22) end function