X-Git-Url: https://projects.mako.cc/source/wikiq/blobdiff_plain/c41704df5969d350317465fabdfa3012150073db..fd20cb1bc83a8062f951fc43ef7dd16d4da1ab04:/disorder.c diff --git a/disorder.c b/disorder.c deleted file mode 100644 index a5f7c35..0000000 --- a/disorder.c +++ /dev/null @@ -1,192 +0,0 @@ -/*************************************************************************** - * libdisorder: A Library for Measuring Byte Stream Entropy - * Copyright (C) 2010 Michael E. Locasto - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the: - * Free Software Foundation, Inc. - * 59 Temple Place, Suite 330 - * Boston, MA 02111-1307 USA - * - * $Id$ - **************************************************************************/ - -#include //for log2() -#include //for NULL -#include "disorder.h" - -#if defined(__FreeBSD__) -#define log2(x) (log((x)) * (1./M_LN2)) -#endif - -/** Frequecies for each byte */ -static int m_token_freqs[LIBDO_MAX_BYTES]; //frequency of each token in sample -static float m_token_probs[LIBDO_MAX_BYTES]; //P(each token appearing) -static int m_num_tokens = 0; //actual number of `seen' tokens, max 256 -static float m_maxent = 0.0; -static float m_ratio = 0.0; -static int LIBDISORDER_INITIALIZED = 0; - -static void -initialize_lib() -{ - int i = 0; - if(1==LIBDISORDER_INITIALIZED) - return; - - m_num_tokens = 0; - - for(i=0;iLIBDO_MAX_BYTES) - { - //report error somehow? - return 0.0; - } - - //iterate through whole m_token_freq array, but only count - //spots that have a registered token (i.e., freq>0) - for(i=0;i