EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
BinAsciiModule Class Reference

#include "BinAsciiModule.h"

Static Public Member Functions

static uint32 crc_hqx (const uint8 *str, size_t len, uint32 crc)
 
static uint32 crc_hqx (std::string &str, uint32 crc)
 
static uint32 crc_hqx (std::wstring &str, uint32 crc)
 
static void hexlify (const char *src, const size_t srclen, char *dst, size_t *dstlen, bool upper=false)
 

Detailed Description

Definition at line 64 of file BinAsciiModule.h.

Member Function Documentation

static uint32 BinAsciiModule::crc_hqx ( const uint8 str,
size_t  len,
uint32  crc 
)
inlinestatic

Definition at line 67 of file BinAsciiModule.h.

68  {
69  uint8* bin_data = (uint8*)str;
70  while(len-- > 0) {
71  crc = ((crc<<8)&0xff00)^crctab_hqx[((crc>>8)&0xff)^*bin_data++];
72  }
73 
74  return crc;
75  }
unsigned __int8 uint8
Definition: eve-compat.h:46
static uint32 BinAsciiModule::crc_hqx ( std::string &  str,
uint32  crc 
)
inlinestatic

Definition at line 77 of file BinAsciiModule.h.

78  {
79  size_t len = str.size();
80  uint8* bin_data = (uint8*)str.c_str();
81  while(len-- > 0) {
82  crc = ((crc<<8)&0xff00)^crctab_hqx[((crc>>8)&0xff)^*bin_data++];
83  }
84 
85  return crc;
86  }
unsigned __int8 uint8
Definition: eve-compat.h:46
static uint32 BinAsciiModule::crc_hqx ( std::wstring &  str,
uint32  crc 
)
inlinestatic

Definition at line 88 of file BinAsciiModule.h.

89  {
90  size_t len = str.size();
91  uint16* bin_data = (uint16*)str.c_str();
92  while(len-- > 0) {
93  crc = ((crc<<8)&0xff00)^crctab_hqx[((crc>>8)&0xff)^*bin_data++];
94  }
95 
96  return crc;
97  }
unsigned __int16 uint16
Definition: eve-compat.h:48
static void BinAsciiModule::hexlify ( const char *  src,
const size_t  srclen,
char *  dst,
size_t *  dstlen,
bool  upper = false 
)
inlinestatic

Definition at line 100 of file BinAsciiModule.h.

101  {
102  size_t i, j;
103  char ch = 'a';
104  if (upper == true)
105  ch = 'A';
106 
107  if (srclen * 2 > *dstlen)
108  return;
109 
110  /* make hex version of string, taken from shamodule.c */
111  for (i=j=0; i < srclen; i++) {
112  char c;
113  c = (src[i] >> 4) & 0xf;
114  c = (c>9) ? c+ch-10 : c + '0';
115  dst[j++] = c;
116  c = src[i] & 0xf;
117  c = (c>9) ? c+ch-10 : c + '0';
118  dst[j++] = c;
119  }
120  *dstlen = i;
121  }

The documentation for this class was generated from the following file: