
#ifndef _WENGO
#include "types.h"
#endif

#ifdef _WENGO
#include "p2pp/common/types.h"
#endif

#include "genhash.h"

#include "sha1.h"
#include "sha256.h"
#include "md4.h"
#include "md5.h"



int32 getHash(uchar* pchKey, int32 kLen, uchar* pchOut, int32& oLen, enum halg eAlg) {
  
  switch(eAlg) {
  
  case eNONE:
      break;

  case eA_SHA1:
    sha1_wrapper(pchKey, kLen, pchOut);
    oLen = 20;
    break;

  case eA_SHA256:
    sha2_csum(pchKey, kLen, pchOut);
    oLen=32;
    break;

  case eA_SHA512:
    break;

  case eA_MD4:
    md4_csum(pchKey, kLen, pchOut);
    oLen=16;
    break;

  case eA_MD5:
    md5_csum(pchKey, kLen, pchOut);
    oLen=16;
    break;
    
  }//end switch
  
  return 1;

}//getHash

