/*
   +----------------------------------------------------------------------+
   | 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: jhash.h,v 1.13 2005/01/06 18:16:42 jay Exp $
*/

#ifndef __JHASH_H__
#define __JHASH_H__

#include "jsink.h"
#include "jhelpers.h"
#include "jconstants.h"


using namespace CryptoPP;

class JHash
{
	public:
		JHash(string plaintext = "");
		~JHash();

		string getPlaintext() const;
		string getHashtext(bool hex = true) const;
		unsigned int getDigestSize() const;
		virtual enum Hash getHashType() const = 0;

		void setPlaintext(string plaintext);
		void setHashtext(string hashtext);

		virtual bool hash() = 0;
		virtual bool validate() = 0;
		virtual bool validate(string plaintext, string hashtext) = 0;

		virtual string hashPHPStream(php_stream* in) = 0;

		/* This is deprecated. It was used before using php_streams. Use it
		   if you're using this code in something other than the cryptopp PHP
		   extension...
		virtual string hashFile(const string filename) = 0; */

	protected:
		HashTransformation* itsHashModule;

		string itsPlaintext;
		string itsHashtext;
};

#endif
