-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from MartKro/graycode
Graycode reimplementation and ecclvl cmake change
- Loading branch information
Showing
5 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
//the security parameter for public crypto | ||
#define ECCLVL @ecclvl@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
\file graycode.cpp | ||
\author Martin Kromm<[email protected]> | ||
\copyright ABY - A Framework for Efficient Mixed-protocol Secure Two-party Computation | ||
Copyright (C) 2019 ENCRYPTO Group, TU Darmstadt | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published | ||
by the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
ABY is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
\brief Gray-Code implementation | ||
*/ | ||
|
||
#include "./graycode.h" | ||
#include <stdlib.h> | ||
|
||
uint32_t* BuildGrayCode(uint32_t length) { | ||
uint32_t* gray_code = (uint32_t*) malloc(sizeof(uint32_t) * length); | ||
for(uint32_t i = 0; i < length; ++i) { | ||
gray_code[i] = i ^ (i >> 1); | ||
} | ||
return gray_code; | ||
} | ||
|
||
uint32_t* BuildGrayCodeIncrement(uint32_t length) { | ||
uint32_t* gray_code_increment = (uint32_t*) malloc(sizeof(uint32_t) * length); | ||
for(uint32_t i = 0; i < length; ++i) { | ||
gray_code_increment[i] = 0; | ||
} | ||
uint32_t length_inc = 2; | ||
while(length_inc < length) { | ||
uint32_t length_count = length_inc - 1; | ||
while(length_count <= length) { | ||
(gray_code_increment[length_count])++; | ||
length_count += length_inc; | ||
} | ||
length_inc = length_inc << 1; | ||
} | ||
return gray_code_increment; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
\file graycode.h | ||
\author Martin Kromm<[email protected]> | ||
\copyright ABY - A Framework for Efficient Mixed-protocol Secure Two-party Computation | ||
Copyright (C) 2019 ENCRYPTO Group, TU Darmstadt | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published | ||
by the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
ABY is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
\brief Gray-Code implementation | ||
*/ | ||
|
||
#include <stdint.h> | ||
|
||
uint32_t* BuildGrayCode(uint32_t length); | ||
uint32_t* BuildGrayCodeIncrement(uint32_t length); |