Пример #1
0
PWIZ_API_DECL string SHA1Calculator::hash(const unsigned char* buffer, size_t bufferSize)
{
    CSHA1 sha1;
    sha1.Update(buffer, static_cast<UINT_32>(bufferSize));
    sha1.Final();
    return formatHash(sha1);
}
Пример #2
0
PWIZ_API_DECL string SHA1Calculator::hashProjected() const
{
    if (impl_->closed) 
        throw runtime_error("[SHA1Calculator::hashProjected()] Should not be called after close().");

    CSHA1 temp(impl_->csha1);
    temp.Final();
    return formatHash(temp);
}
Пример #3
0
PWIZ_API_DECL string SHA1Calculator::hashFile(const string& filename)
{
    CSHA1 sha1;

    if (!(sha1.HashFile(filename.c_str())))
        throw runtime_error(("[SHA1Calculator] Error hashing file " + filename).c_str());

    sha1.Final();
    return formatHash(sha1);
}
Пример #4
0
PWIZ_API_DECL string SHA1Calculator::hash(istream& is)
{
    CSHA1 sha1;
    is.clear();
    is.seekg(0);
    unsigned char buffer[65535];
    while (is && is.read(reinterpret_cast<char*>(buffer), 65535))
        sha1.Update(buffer, 65535u);
    sha1.Update(buffer, is.gcount());
    sha1.Final();
    return formatHash(sha1);
}
Пример #5
0
PWIZ_API_DECL string SHA1Calculator::hash(istream& is)
{
    CSHA1 sha1;
    is.clear();
    is.seekg(0);
    unsigned char buffer[65535];
    size_t bytesRead;
    while (is && (bytesRead = is.readsome(reinterpret_cast<char*>(buffer), 65535)) > 0)
        sha1.Update(buffer, static_cast<UINT_32>(bytesRead));
    sha1.Final();
    return formatHash(sha1);
}
QVariant DecisionDecisionTableModel::data(const QModelIndex &index, int role) const
{
    if(!index.isValid())
        return QVariant();
    const marketDecision *decision = (const marketDecision *) index.internalPointer();

    switch(role)
    {
    case Qt::DisplayRole:
        switch(index.column())
        {
        case Address:
            return formatAddress(decision);
        case Prompt:
            return formatPrompt(decision);
        case EventOverBy:
            return QVariant((int)decision->eventOverBy);
        case IsScaled:
            return formatIsScaled(decision);
        case Minimum:
            return QVariant((double)decision->min*1e-8);
        case Maximum:
            return QVariant((double)decision->max*1e-8);
        case AnswerOptional:
            return formatAnswerOptional(decision);
        case Hash:
            return formatHash(decision);
        default:
            ;
        }
        break;
    case AddressRole:
        return formatAddress(decision);
    case PromptRole:
        return formatPrompt(decision);
    case Qt::TextAlignmentRole:
        return column_alignments[index.column()];
    }
    return QVariant();
}
Пример #7
0
PWIZ_API_DECL string SHA1Calculator::hash() const
{
    return formatHash(impl_->csha1);
}