bool verify_update_signature(dwindow_update_signature *signature) { if (!signature) return false; unsigned char sha1[20]; SHA1Hash(sha1, ((unsigned char*)signature) + sizeof(signature->signature), sizeof(dwindow_update_signature) - sizeof(signature->signature)); return verify_signature((DWORD*)sha1, (DWORD*)signature->signature, dwindow_network_n); }
void TorrentGroup::load(bt::BDictNode* dn) { name = QString::fromLocal8Bit(dn->getByteArray("name")); setIconByName(QString::fromLocal8Bit(dn->getByteArray("icon"))); BListNode* ln = dn->getList("hashes"); if (!ln) return; path = "/all/custom/" + name; for (Uint32 i = 0; i < ln->getNumChildren(); i++) { QByteArray ba = ln->getByteArray(i); if (ba.size() != 20) continue; hashes.insert(SHA1Hash((const Uint8*)ba.data())); } BDictNode* gp = dn->getDict(QString("policy")); if (gp) { // load the group policy if (gp->getValue("default_save_location")) { policy.default_save_location = gp->getString("default_save_location", 0); if (policy.default_save_location.length() == 0) policy.default_save_location = QString(); // make sure that 0 length strings are loaded as null strings } if (gp->getValue("default_move_on_completion_location")) { policy.default_move_on_completion_location = gp->getString("default_move_on_completion_location", 0); if (policy.default_move_on_completion_location.length() == 0) policy.default_move_on_completion_location = QString(); // make sure that 0 length strings are loaded as null strings } if (gp->getValue("max_share_ratio")) policy.max_share_ratio = gp->getString("max_share_ratio", 0).toFloat(); if (gp->getValue("max_seed_time")) policy.max_seed_time = gp->getString("max_seed_time", 0).toFloat(); if (gp->getValue("max_upload_rate")) policy.max_upload_rate = gp->getInt("max_upload_rate"); if (gp->getValue("max_download_rate")) policy.max_download_rate = gp->getInt("max_download_rate"); if (gp->getValue("only_apply_on_new_torrents")) policy.only_apply_on_new_torrents = gp->getInt("only_apply_on_new_torrents"); } }
void MainWindow::TextChanged(QString text) { if(text.isEmpty()) { this->ui->lineEdit_2->setText("Enter some text"); return; } QString str; switch(this->comboselected) { case 0: // MD5 this->ui->lineEdit_2->setText(QString().fromStdString(md5(text.toStdString()))); break; case 1: // MD4 //this->ui->lineEdit_2->setText(); break; case 2: // SHA-1 this->ui->lineEdit_2->setText(SHA1Hash(text)); break; case 3: // SHA-2 //this->ui->lineEdit_2->setText(); break; case 4: // SHA-3 //this->ui->lineEdit_2->setText(); break; case 5: // SHA-256 this->ui->lineEdit_2->setText(SHA256Hash(text)); break; case 6: // SHA-384 //this->ui->lineEdit_2->setText(); break; case 7: // SHA-512 //this->ui->lineEdit_2->setText(); break; case 8: // RIPEMD-128 //this->ui->lineEdit_2->setText(); break; case 9: // RIPEMD-160 //this->ui->lineEdit_2->setText(); break; case 10: // Whirlpool //this->ui->lineEdit_2->setText(); break; case 11: // GOST //this->ui->lineEdit_2->setText(); break; case 12: // Tiger //this->ui->lineEdit_2->setText(); break; case 13: // Skein //this->ui->lineEdit_2->setText(); break; case 14: // Blake if(BlakeHash(str, text)) this->ui->lineEdit_2->setText(str); break; case 15: // NONE this->ui->lineEdit_2->setText(text); break; default: break; } }