Pages

Friday, 16 September 2016

Compute Digest Using Md5,SHA1,SHA256,SHA384,SHA512,SHA3-224,SHA3-256,SHA3-512


I Want To Show You How to compute digest  Using Md5,SHA1,SHA256,SHA384,SHA512,SHA3-224,SHA3-256,SHA3-512 in QT. This my code,
      #include <QCryptographicHash> 
       -------
       -------
    // MD5
    QCryptographicHash cryptoHashMd5(QCryptographicHash::Md5);

    //SHA1
    QCryptographicHash cryptoHashSHA1(QCryptographicHash::Sha1);

    //SHA224
    QCryptographicHash cryptoHashSHA224(QCryptographicHash::Sha224);

    //SHA256
    QCryptographicHash cryptoHashSHA256(QCryptographicHash::Sha256);

    //SHA 384
    QCryptographicHash cryptoHashSHA384(QCryptographicHash::Sha384);

    //SHA 512
    QCryptographicHash cryptoHashSHA512(QCryptographicHash::Sha512);

    //SHA3-256
    QCryptographicHash cryptoHashSHA3256(QCryptographicHash::Sha3_256);

    //SHA3-224
    QCryptographicHash cryptoHashSHA3224(QCryptographicHash::Sha3_224);

    //SHA3-512
    QCryptographicHash cryptoHashSHA3512(QCryptographicHash::Sha3_512);

    //Compute input digest using Md5
    cryptoHashMd5.addData(ui->textEdit_input->toPlainText().toLatin1());

    //Compute input digest using SHA1
    cryptoHashSHA1.addData(ui->textEdit_input->toPlainText().toLatin1());

    //Compute input digest using SHA224
    cryptoHashSHA224.addData(ui->textEdit_input->toPlainText().toLatin1());

    //Compute input digest using SHA256
    cryptoHashSHA256.addData(ui->textEdit_input->toPlainText().toLatin1());

    //Compute input digest using SHA384
    cryptoHashSHA384.addData(ui->textEdit_input->toPlainText().toLatin1());

    //Compute input digest using SHA512
    cryptoHashSHA512.addData(ui->textEdit_input->toPlainText().toLatin1());

    //Compute input digest using SHA3-256
    cryptoHashSHA3256.addData(ui->textEdit_input->toPlainText().toLatin1());

    //Compute input digest using SHA3-224
    cryptoHashSHA3224.addData(ui->textEdit_input->toPlainText().toLatin1());

    //Compute input digest using SHA3-512
    cryptoHashSHA3512.addData(ui->textEdit_input->toPlainText().toLatin1());

    //set Output Digest MD5
    ui->lineEdit_MD5->setText(cryptoHashMd5.result().toHex().data());
    //set Output Digest SHA1
    ui->lineEdit_SHA1->setText(cryptoHashSHA1.result().toHex().data());
    //set Output Digest SHA224
    ui->lineEdit_SHA224->setText(cryptoHashSHA224.result().toHex().data());
    //set Output Digest SHA256
    ui->lineEdit_SHA256->setText(cryptoHashSHA256.result().toHex().data());
    //Set Output Digest SHA384
    ui->textEdit_OutputSHA384->setText(cryptoHashSHA384.result().toHex().data());
    //Set Output Digest SHA512
    ui->textEdit_OutputSHA512->setText(cryptoHashSHA512.result().toHex().data());
    //Set Output Digest SHA3-256
    ui->textEdit_OutputSHA3256->setText(cryptoHashSHA3256.result().toHex().data());
    //Set Output Digest SHA3-224
    ui->lineEdit_SHA3224->setText(cryptoHashSHA3224.result().toHex().data());
    //Set Ouput Digest SHA3-512
    ui->textEdit_OutputSHA3512->setText(cryptoHashSHA3512.result().toHex().data());

For Detail, Please watch my video. Thanks


0 comments:

Post a Comment