00001 /* 00002 * MCE, the real life implementation of McEliece encryption scheme. 00003 * Copyright Projet SECRET, INRIA, Rocquencourt and Bhaskar Biswas and 00004 * Nicolas Sendrier (Bhaskar.Biswas@inria.fr, Nicolas.Sendrier@inria.fr). 00005 * 00006 * This is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU Lesser General Public License as 00008 * published by the Free Software Foundation; either version 2.1 of 00009 * the License, or (at your option) any later version. 00010 * 00011 * This software is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this software; if not, write to the Free 00018 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00019 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 00020 */ 00021 #include <stdlib.h> 00022 #include <stdio.h> 00023 #include "workfactor.h" 00024 00025 int main(int argc, char ** argv) { 00026 int n, k, t, m, tmin, tmax; 00027 00028 m = atoi(argv[1]); 00029 n = 1 << m; 00030 t = (argc > 2) ? atoi(argv[2]) : 0; 00031 if (t != 0) 00032 tmin = tmax = t; 00033 else { 00034 tmin = 2; 00035 tmax = n / m; 00036 } 00037 00038 for (t = tmin; t <= tmax; ++t) { 00039 k = n - t * m; 00040 00041 printf("%d\t%d\t%g\n", m, t, workfactor(n, k, t)); 00042 } 00043 00044 return 1; 00045 }