QT MD5 SHA1加密使用

来源:互联网 发布:洗脑神曲排行榜 知乎 编辑:程序博客网 时间:2024/06/01 08:06

MD5 hash

QString md5;

QString aStr="Nokia Qt";

QByteArraybb;

bb = QCryptographicHash::hash(aStr.toAscii(),QCryptographicHash::Md5 );
md5.append(bb.toHex());
 
sha1 hash
QString res="";    QByteArray string=aStr.toAscii();    QCryptographicHash *hash=new QCryptographicHash(QCryptographicHash::Sha1);    
hash->addData(string);    QByteArray sha1=hash->result(); 
 
转自:http://blog.csdn.net/guhog/article/details/4203021
原创粉丝点击