std::string BigData::Mod(std::string left, std::string right) { char cSymbol = left[0]; BigData n1(left.c_str() + 1); BigData n2(right.c_str() + 1); BigData n3 = n1 / n2; BigData n4 = n3*n2; BigData sRet(n1 - n4); sRet._strData[0] = cSymbol; return sRet._strData; }
wstring ConvertCodepageToWString( RString s, int iCodePage ) { if( s.empty() ) return wstring(); int iBytes = MultiByteToWideChar( iCodePage, 0, s.data(), s.size(), NULL, 0 ); ASSERT_M( iBytes > 0, werr_ssprintf( GetLastError(), "MultiByteToWideChar" ).c_str() ); wchar_t *pTemp = new wchar_t[iBytes]; MultiByteToWideChar( iCodePage, 0, s.data(), s.size(), pTemp, iBytes ); wstring sRet( pTemp, iBytes ); delete [] pTemp; return sRet; }
String<char> Digest::Canonical() const { size_t rawLen = m_Raw.Length(); size_t hrLen = rawLen * 2; char humanReadable[128]; for (size_t i = 0; i < 128; i++) humanReadable[i] = '_'; humanReadable[hrLen] = '\0'; for (size_t i = 0; i < rawLen; i++) { byte_t byte = m_Raw[i]; byte_t modulo = byte % 16; char c_big = digits[(byte - modulo) / 16]; char c_little = digits[modulo]; humanReadable[i * 2] = c_big; humanReadable[i * 2 + 1] = c_little; } String<char> sRet(humanReadable); return sRet; }