Пример #1
0
void Error(errType err, int32 errpos, const char *str, alert_type type)
{	
	// if (errpos - prevError < 10) return;	
	
	BString eStr(str);
	eStr.Append("\n"); eStr.Append(ErrorS[err]);
	eStr.Insert("«", errpos-1);
	prevError = errpos;
	BAlert *alert = new BAlert("Error", eStr.String(), "Continue", NULL, NULL, B_WIDTH_AS_USUAL, type);
	alert->Go();
};
Пример #2
0
RSAPublicKey::RSAPublicKey(const char *key) : impl_(new Impl(key)) {
	if (!impl_->rsa) return;

	int nBytes = BN_num_bytes(impl_->rsa->n);
	int eBytes = BN_num_bytes(impl_->rsa->e);
	std::string nStr(nBytes, 0), eStr(eBytes, 0);
	BN_bn2bin(impl_->rsa->n, (uchar*)&nStr[0]);
	BN_bn2bin(impl_->rsa->e, (uchar*)&eStr[0]);

	mtpBuffer tmp;
	MTP_string(nStr).write(tmp);
	MTP_string(eStr).write(tmp);

	uchar sha1Buffer[20];
	impl_->fp = *(uint64*)(hashSha1(&tmp[0], tmp.size() * sizeof(mtpPrime), sha1Buffer) + 3);
}