示例#1
0
static int BBSR(double s,NumFunc_1*p,double t,double r,double divid,double sigma,int N, double *ptprice,double *ptdelta)
{
  double price1,delta1,price2,delta2;

  BBS(s,p,t,r,divid,sigma,N,&price1,&delta1);
  BBS(s,p,t,r,divid,sigma,N/2,&price2,&delta2);

  /*Price*/
  *ptprice=2.*price1-price2;

  /*Delta*/
  *ptdelta=2.*delta1-delta2;

  return OK;
}
unsigned int OpenPGPCryptoProvider::getRandom(unsigned char * buffer, unsigned int numOctets) const {

	BBS(static_cast <PGPMPI> (static_cast <int> (now()))); // seed just in case not seeded

	std::string t = BBS::rand(numOctets << 3);
	memcpy(buffer, t.data(), numOctets);

	return numOctets;

}
示例#3
0
#define CMP(read1, read2) SMP_OP_ALU_CMP_DECL(read1, read2)

#define RMW(type, op) SMP_OP_RMW_##type##_DECL(op)
#define RMWW(op) SMP_OP_RMWW_DP_DECL(op)

#define MOVE(dst, src) SMP_OP_MOVE_##dst##_DECL(src)
#define MOVE_(dst, src) SMP_OP_MOVE_DECL(dst, src)

#define BRANCH(flag) SMP_OP_BRANCH_FLAG_DECL(flag)
#define BRANCH_N(flag) SMP_OP_BRANCH_N_FLAG_DECL(flag)

smp_op_t ssnes_smp_optable[256] = {
   NOP,                    // 0x00
   TCALL(0),               // 0x01
   SET1(0),                // 0x02
   BBS(0),                 // 0x03
   ALU(DP, or),            // 0x04
   ALU(ADDR, or),          // 0x05
   ALU(DPX, or),           // 0x06
   ALU(IDPX, or),          // 0x07
   ALU(IMM, or),           // 0x08
   ALU(DP_DP, or),         // 0x09
   ALU(BIT, or1),          // 0x0a
   RMW(DP, asl),           // 0x0b
   RMW(ADDR, asl),         // 0x0c
   smp_op_push_p,          // 0x0d
   smp_op_rmw_tset,        // 0x0e
   smp_op_brk,             // 0x0f

   BRANCH_N(n),            // 0x10
   TCALL(1),               // 0x11
示例#4
0
void ApuE3()
{
   BBS(7);
}
示例#5
0
void ApuC3()
{
   BBS(6);
}
示例#6
0
void ApuA3()
{
   BBS(5);
}
示例#7
0
void Apu83()
{
   BBS(4);
}
示例#8
0
void Apu63()
{
   BBS(3);
}
示例#9
0
void Apu43()
{
   BBS(2);
}
示例#10
0
void Apu23()
{
   BBS(1);
}
示例#11
0
void Apu03()
{
   BBS(0);
}
示例#12
0
    }
    else{
        std::stringstream s; s << static_cast <unsigned int> (pka);
        throw std::runtime_error("Error: PKA number " + s.str() + " not allowed or unknown.");
    }
    return {}; // should never reach here; mainly just to remove compiler warnings
}

std::vector <PGPMPI> pka_encrypt(const uint8_t pka, const std::string & data, const std::vector <PGPMPI> & pub){
    return pka_encrypt(pka, rawtompi(data), pub);
}

Packet::Ptr encrypt_data(const std::string & session_key, const std::string & data, const std::string & filename, const uint8_t sym_alg, const uint8_t comp, const bool mdc, const PGPSecretKey::Ptr & signer, const std::string & sig_passphrase){
    // generate prefix
    uint16_t BS = Symmetric_Algorithm_Block_Length.at(Symmetric_Algorithms.at(sym_alg)) >> 3;
    std::string prefix = unhexlify(zfill(bintohex(BBS().rand(BS << 3)), BS << 1, '0'));

    std::string to_encrypt;

    // put data in Literal Data Packet
    Tag11 tag11;
    tag11.set_format('t');
    tag11.set_filename(filename);
    tag11.set_time(0);
    tag11.set_literal(data);

    to_encrypt = tag11.write(2);

    // // if message is to be signed
    // if (signer){
        // // find preferred hash and compression algorithms of the signer