Beispiel #1
0
Coin::Coin(const PublicAddress& addr, uint64_t value): addr_pk(addr), cm(), rho(rho_size), r(zc_r_size), k(k_size), coinValue(v_size)
{
    convertIntToBytesVector(value, this->coinValue);

    std::vector<unsigned char> a_pk = addr.getPublicAddressSecret();

    unsigned char rho_bytes[rho_size];
    getRandBytes(rho_bytes, rho_size);
    convertBytesToBytesVector(rho_bytes, this->rho);

    unsigned char r_bytes[zc_r_size];
    getRandBytes(r_bytes, zc_r_size);
    convertBytesToBytesVector(r_bytes, this->r);

	this->computeCommitments(a_pk);
}
Beispiel #2
0
void AlgTestDlg::OnBnClickedBtnGenkey(){
	cmb_name.GetLBText(cmb_name.GetCurSel(),cur_alg_name);
	cmb_type.GetLBText(cmb_type.GetCurSel(),cur_alg_type);

	cipherAlg->setAlg(Manage::typeStr2Int(cur_alg_type),cur_alg_name);
	int len = cipherAlg->GetLength(KEY_LEN);
	CString randStr = Byte2CString(getRandBytes("BBS",len),len);
	cstr_key = randStr;
	UpdateData(false);
}
Beispiel #3
0
void AlgTestDlg::OnBnClickedBtnGeniv(){
	cmb_name.GetLBText(cmb_name.GetCurSel(),cur_alg_name);
	cmb_type.GetLBText(cmb_type.GetCurSel(),cur_alg_type);
	int type = Manage::typeStr2Int(cur_alg_type);
	int len;
	cipherAlg->setAlg(Manage::typeStr2Int(cur_alg_type),cur_alg_name);
	if(type == STREAM) len = cipherAlg->GetLength(IV_LEN);
	else if (type == BLOCK) len = cipherAlg->GetLength(BLOCK_SIZE);
	CString randStr = Byte2CString(getRandBytes("BBS",len),len);
	cstr_iv = randStr;
	UpdateData(false);
}