void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device) { int nPoints = pPathData->GetPointCount(); CFX_ByteTextBuf buf; buf.EstimateSize(nPoints * 10); for (int i = 0; i < nPoints; i ++) { FX_BYTE flag = pPathData->GetFlag(i); FX_FLOAT x = pPathData->GetPointX(i); FX_FLOAT y = pPathData->GetPointY(i); if (pObject2Device) { pObject2Device->Transform(x, y); } buf << x << FX_BSTRC(" ") << y; switch (flag & FXPT_TYPE) { case FXPT_MOVETO: buf << FX_BSTRC(" m "); break; case FXPT_LINETO: if (flag & FXPT_CLOSEFIGURE) { buf << FX_BSTRC(" l h "); } else { buf << FX_BSTRC(" l "); } break; case FXPT_BEZIERTO: { FX_FLOAT x1 = pPathData->GetPointX(i + 1); FX_FLOAT x2 = pPathData->GetPointX(i + 2); FX_FLOAT y1 = pPathData->GetPointY(i + 1); FX_FLOAT y2 = pPathData->GetPointY(i + 2); if (pObject2Device) { pObject2Device->Transform(x1, y1); pObject2Device->Transform(x2, y2); } buf << FX_BSTRC(" ") << x1 << FX_BSTRC(" ") << y1 << FX_BSTRC(" ") << x2 << FX_BSTRC(" ") << y2; if (flag & FXPT_CLOSEFIGURE) { buf << FX_BSTRC(" c h\n"); } else { buf << FX_BSTRC(" c\n"); } i += 2; break; } } } m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); }
void Revision6_Hash(const uint8_t* password, uint32_t size, const uint8_t* salt, const uint8_t* vector, uint8_t* hash) { int iBlockSize = 32; uint8_t sha[128]; CRYPT_SHA256Start(sha); CRYPT_SHA256Update(sha, password, size); CRYPT_SHA256Update(sha, salt, 8); if (vector) { CRYPT_SHA256Update(sha, vector, 48); } uint8_t digest[32]; CRYPT_SHA256Finish(sha, digest); CFX_ByteTextBuf buf; uint8_t* input = digest; uint8_t* key = input; uint8_t* iv = input + 16; uint8_t* E = buf.GetBuffer(); int iBufLen = buf.GetLength(); CFX_ByteTextBuf interDigest; int i = 0; uint8_t* aes = FX_Alloc(uint8_t, 2048); while (i < 64 || i < E[iBufLen - 1] + 32) { int iRoundSize = size + iBlockSize; if (vector) { iRoundSize += 48; } iBufLen = iRoundSize * 64; buf.EstimateSize(iBufLen); E = buf.GetBuffer(); CFX_ByteTextBuf content; for (int j = 0; j < 64; ++j) { content.AppendBlock(password, size); content.AppendBlock(input, iBlockSize); if (vector) { content.AppendBlock(vector, 48); } } CRYPT_AESSetKey(aes, 16, key, 16, TRUE); CRYPT_AESSetIV(aes, iv); CRYPT_AESEncrypt(aes, E, content.GetBuffer(), iBufLen); int iHash = 0; switch (BigOrder64BitsMod3(E)) { case 0: iHash = 0; iBlockSize = 32; break; case 1: iHash = 1; iBlockSize = 48; break; default: iHash = 2; iBlockSize = 64; break; } interDigest.EstimateSize(iBlockSize); input = interDigest.GetBuffer(); if (iHash == 0) { CRYPT_SHA256Generate(E, iBufLen, input); } else if (iHash == 1) { CRYPT_SHA384Generate(E, iBufLen, input); } else if (iHash == 2) { CRYPT_SHA512Generate(E, iBufLen, input); } key = input; iv = input + 16; ++i; } FX_Free(aes); if (hash) { FXSYS_memcpy(hash, input, 32); } }