/*
   +----------------------------------------------------------------------+
   | Copyright (c) 2002-2005 J Smith <dark_panda@hushmail.com>            |
   | Crypto++ sources (not included) copyright (c) 1995-2003 Wei Dai      |
   +----------------------------------------------------------------------+
   | Check out COPYING for the exact license.                             |
   +----------------------------------------------------------------------+

$Id: jhelpers.h,v 1.15 2005/01/06 18:16:42 jay Exp $
*/

#ifndef __JHELPERS_H__
#define __JHELPERS_H__

#include <string>
#include <cctype>

// Crypto++ headers...

#include "hex.h"
#include "osrng.h"

// PHP headers...

#ifdef PHP_WIN32
#include <cmath>
#endif

extern "C" {
#include "php.h"
#include "ext/standard/php_rand.h"
}

#include "jconstants.h"

typedef unsigned char byte;

using namespace std;

string bin2hex(string bin);
string hex2bin(string hex);

string strtoupper(string str);

string generateIV(const unsigned int size, const enum RNG rng = DEFAULT_RNG);

// used to check the bounds of things like keylengths,
// rounds to perform, etc.:

unsigned int checkBounds(unsigned int length, unsigned int min, unsigned int max, unsigned short int multiple = 1);

#endif
