MCPcopy Create free account
hub / github.com/cxasm/notepad-- / on_hash

Method on_hash

src/md5hash.cpp:63–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63void Md5hash::on_hash()
64{
65 QCryptographicHash::Algorithm method = QCryptographicHash::Md5;
66
67 if (ui.md5RadioBt->isChecked())
68 {
69 method = QCryptographicHash::Md5;
70 }
71 else if (ui.md4RadioBt->isChecked())
72 {
73 method = QCryptographicHash::Md4;
74 }
75 else if (ui.sha1RadioBt->isChecked())
76 {
77 method = QCryptographicHash::Sha1;
78 }
79 else if (ui.sha256RadioBt->isChecked())
80 {
81 method = QCryptographicHash::Sha256;
82 }
83 else if (ui.sha3RadioBt->isChecked())
84 {
85 method = QCryptographicHash::Sha3_256;
86 }
87 else if (ui.kec256RadioBt->isChecked())
88 {
89 method = QCryptographicHash::Keccak_256;
90 }
91
92 //������ı�
93 if (!m_isFile)
94 {
95 QString text = ui.srcTextEdit->toPlainText();
96
97 QByteArray data = text.toUtf8();
98
99 if (!text.isEmpty())
100 {
101 QByteArray result = QCryptographicHash::hash(data, method);
102 ui.hashTextEdit->setPlainText(result.toHex());
103 }
104 }
105 else
106 {
107 QCryptographicHash fileHash(method);
108 QByteArray rs;
109
110 QList<QByteArray> result;
111
112 for (int i = 0; i < m_fileList.size(); ++i)
113 {
114 rs.clear();
115 QFile file(m_fileList.at(i));
116 if (file.open(QIODevice::ReadOnly))
117 {
118 if (fileHash.addData(&file))
119 {
120 rs = fileHash.result();

Callers

nothing calls this directly

Calls 5

isEmptyMethod · 0.80
appendMethod · 0.80
closeMethod · 0.80
sizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected