×
Namespaces

Variants
Actions
(Difference between revisions)

Como criptografar um texto usando QCryptographicHash, em Qt

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Bot fixing redirect link)
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot change of template (Template:CodeSnippet) - now using Template:ArticleMetaData)
Line 5: Line 5:
 
__NOTOC__
 
__NOTOC__
 
__NOEDITSECTION__
 
__NOEDITSECTION__
{{CodeSnippet
+
{{ArticleMetaData
 
|id=...
 
|id=...
 
|platform=S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition  
 
|platform=S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition  
Line 13: Line 13:
 
|creationdate=10 April 2009
 
|creationdate=10 April 2009
 
|keywords=QCryptographicHash,QByteArray
 
|keywords=QCryptographicHash,QByteArray
 +
 +
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
 +
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 +
|sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
 +
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
 +
|signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
 +
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices.) -->
 +
|author=[[User:Valderind4]]
 
}}
 
}}
  

Revision as of 09:36, 26 June 2011

Original em: How to Encrypt a text using QCryptographicHash in Qt for Symbian


Article Metadata
Tested with
Devices(s): S60 Emulator
Compatibility
Platform(s): S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition
Symbian
Article
Keywords: QCryptographicHash,QByteArray
Created: valderind4 (10 Apr 2009)
Last edited: hamishwillee (26 Jun 2011)

Introdução

A classe QCryptographicHash provê um modo de gerar hashes de criptografia, podendo ser usada para hashes de criptografia de binários ou de dados de textos.

Este criptografia é usada quando você deseja enviar alguma informação de um modo seguro. O texto criptografado é chamado de texto chiper.

Pré-requisitos

  • Baixe e instale a versão atual do Qt para Symbian segundo as instruções deste artigo.

Algumas funcionalidades relacionadas

  • Adiciona às informações hashes de criptografia.
QByteArray string="Nokia";
hash->addData(string);
  • Retorna o valor hash final.
QByteArray string1=hash->result();

Código fonte

Main.cpp

#include <QtGui/QApplication>
#include "textcodec.h"
#include<QWidget>
#include<QHBoxLayout>
#include <QCryptographicHash>
#include<QString>
#include<QByteArray>
#include<QLabel>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget *win=new QWidget();
QHBoxLayout *lay=new QHBoxLayout();
QLabel *lbl=new QLabel();
QLabel *lbl1=new QLabel("Encrypted Text:");
lbl1->setBuddy(lbl);
QByteArray string="Nokia";
QCryptographicHash *hash=new QCryptographicHash(QCryptographicHash::Md4);
hash->addData(string);
QByteArray string1=hash->result();
lbl->setText(string1);
lay->addWidget(lbl1);
lay->addWidget(lbl);
win->setLayout(lay);
win->setStyleSheet("* { background-color:rgb(199,147,88); padding: 7px ; color:rgb(255,255,255)}");
win->showMaximized();
return a.exec();
}

Captura de tela

Leia mais: QCryptographicHash

Crypto.JPG

99 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×