本文整理汇总了C++中F3函数的典型用法代码示例。如果您正苦于以下问题:C++ F3函数的具体用法?C++ F3怎么用?C++ F3使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了F3函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: F1
void CAST128::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const
{
word32 t, l, r;
/* Get inblock into l,r */
Block::Get(inBlock)(r)(l);
/* Only do full 16 rounds if key length > 80 bits */
if (!reduced) {
F1(r, l, 15, 16);
F3(l, r, 14, 16);
F2(r, l, 13, 16);
F1(l, r, 12, 16);
}
F3(r, l, 11, 16);
F2(l, r, 10, 16);
F1(r, l, 9, 16);
F3(l, r, 8, 16);
F2(r, l, 7, 16);
F1(l, r, 6, 16);
F3(r, l, 5, 16);
F2(l, r, 4, 16);
F1(r, l, 3, 16);
F3(l, r, 2, 16);
F2(r, l, 1, 16);
F1(l, r, 0, 16);
/* Put l,r into outblock */
Block::Put(xorBlock, outBlock)(l)(r);
/* Wipe clean */
t = l = r = 0;
}
示例2: FOR_BLOCKS
FOR_BLOCKS(length, dst, src, CAST128_BLOCK_SIZE)
{
uint32_t t, l, r;
/* Get inblock into l,r */
l = READ_UINT32(src);
r = READ_UINT32(src+4);
/* Do the work */
F1(l, r, 0);
F2(r, l, 1);
F3(l, r, 2);
F1(r, l, 3);
F2(l, r, 4);
F3(r, l, 5);
F1(l, r, 6);
F2(r, l, 7);
F3(l, r, 8);
F1(r, l, 9);
F2(l, r, 10);
F3(r, l, 11);
/* Only do full 16 rounds if key length > 80 bits */
if (ctx->rounds > 12) {
F1(l, r, 12);
F2(r, l, 13);
F3(l, r, 14);
F1(r, l, 15);
}
/* Put l,r into outblock */
WRITE_UINT32(dst, r);
WRITE_UINT32(dst + 4, l);
/* Wipe clean */
t = l = r = 0;
}
示例3: F1
void CAST256::W(const uint8_t i){
g ^= F1(h, Tm[0][i], Tr[0][i]);
f ^= F2(g, Tm[1][i], Tr[1][i]);
e ^= F3(f, Tm[2][i], Tr[2][i]);
d ^= F1(e, Tm[3][i], Tr[3][i]);
c ^= F2(d, Tm[4][i], Tr[4][i]);
b ^= F3(c, Tm[5][i], Tr[5][i]);
a ^= F1(b, Tm[6][i], Tr[6][i]);
h ^= F2(a, Tm[7][i], Tr[7][i]);
}
示例4: W
/* forward octave */
static inline void W(u32 *key, unsigned int i) {
u32 I;
key[6] ^= F1(key[7], Tr[i % 4][0], Tm[i][0]);
key[5] ^= F2(key[6], Tr[i % 4][1], Tm[i][1]);
key[4] ^= F3(key[5], Tr[i % 4][2], Tm[i][2]);
key[3] ^= F1(key[4], Tr[i % 4][3], Tm[i][3]);
key[2] ^= F2(key[3], Tr[i % 4][4], Tm[i][4]);
key[1] ^= F3(key[2], Tr[i % 4][5], Tm[i][5]);
key[0] ^= F1(key[1], Tr[i % 4][6], Tm[i][6]);
key[7] ^= F2(key[0], Tr[i % 4][7], Tm[i][7]);
}
示例5: cast5_encrypt
static void cast5_encrypt(struct crypto_tfm *tfm, u8 *outbuf, const u8 *inbuf)
{
struct cast5_ctx *c = crypto_tfm_ctx(tfm);
const __be32 *src = (const __be32 *)inbuf;
__be32 *dst = (__be32 *)outbuf;
u32 l, r, t;
u32 I; /* used by the Fx macros */
u32 *Km;
u8 *Kr;
Km = c->Km;
Kr = c->Kr;
/* (L0,R0) <-- (m1...m64). (Split the plaintext into left and
* right 32-bit halves L0 = m1...m32 and R0 = m33...m64.)
*/
l = be32_to_cpu(src[0]);
r = be32_to_cpu(src[1]);
/* (16 rounds) for i from 1 to 16, compute Li and Ri as follows:
* Li = Ri-1;
* Ri = Li-1 ^ f(Ri-1,Kmi,Kri), where f is defined in Section 2.2
* Rounds 1, 4, 7, 10, 13, and 16 use f function Type 1.
* Rounds 2, 5, 8, 11, and 14 use f function Type 2.
* Rounds 3, 6, 9, 12, and 15 use f function Type 3.
*/
t = l; l = r; r = t ^ F1(r, Km[0], Kr[0]);
t = l; l = r; r = t ^ F2(r, Km[1], Kr[1]);
t = l; l = r; r = t ^ F3(r, Km[2], Kr[2]);
t = l; l = r; r = t ^ F1(r, Km[3], Kr[3]);
t = l; l = r; r = t ^ F2(r, Km[4], Kr[4]);
t = l; l = r; r = t ^ F3(r, Km[5], Kr[5]);
t = l; l = r; r = t ^ F1(r, Km[6], Kr[6]);
t = l; l = r; r = t ^ F2(r, Km[7], Kr[7]);
t = l; l = r; r = t ^ F3(r, Km[8], Kr[8]);
t = l; l = r; r = t ^ F1(r, Km[9], Kr[9]);
t = l; l = r; r = t ^ F2(r, Km[10], Kr[10]);
t = l; l = r; r = t ^ F3(r, Km[11], Kr[11]);
if (!(c->rr)) {
t = l; l = r; r = t ^ F1(r, Km[12], Kr[12]);
t = l; l = r; r = t ^ F2(r, Km[13], Kr[13]);
t = l; l = r; r = t ^ F3(r, Km[14], Kr[14]);
t = l; l = r; r = t ^ F1(r, Km[15], Kr[15]);
}
/* c1...c64 <-- (R16,L16). (Exchange final blocks L16, R16 and
* concatenate to form the ciphertext.) */
dst[0] = cpu_to_be32(r);
dst[1] = cpu_to_be32(l);
}
示例6: QBAR
/*reverse quad round*/
static inline void QBAR (u32 * block, u8 * Kr, u32 * Km) {
u32 I;
block[3] ^= F1(block[0], Kr[3], Km[3]);
block[0] ^= F3(block[1], Kr[2], Km[2]);
block[1] ^= F2(block[2], Kr[1], Km[1]);
block[2] ^= F1(block[3], Kr[0], Km[0]);
}
示例7: rubikStep
void rubikStep(char *step)
{
u8 m=0;
for(m=0;step[m]!=0;m++)
{
switch(step[m])
{
case 7:allright90();break;
case 11:F1();break;
case 12:F2();break;
case 13:F3();break;
case 21:B1();break;
case 22:B2();break;
case 23:B3();break;
case 31:R1();break;
case 32:R2();break;
case 33:R3();break;
case 41:L1();break;
case 42:L2();break;
case 43:L3();break;
case 51:U1();break;
case 52:U2();break;
case 53:U3();break;
case 61:D1();break;
case 62:D2();break;
case 63:D3();break;
default:break;
}
}
}
示例8: cast5_decrypt
static void cast5_decrypt(void *ctx, u8 * outbuf, const u8 * inbuf)
{
struct cast5_ctx *c = (struct cast5_ctx *) ctx;
const __be32 *src = (const __be32 *)inbuf;
__be32 *dst = (__be32 *)outbuf;
u32 l, r, t;
u32 I;
u32 *Km;
u8 *Kr;
Km = c->Km;
Kr = c->Kr;
l = be32_to_cpu(src[0]);
r = be32_to_cpu(src[1]);
if (!(c->rr)) {
t = l; l = r; r = t ^ F1(r, Km[15], Kr[15]);
t = l; l = r; r = t ^ F3(r, Km[14], Kr[14]);
t = l; l = r; r = t ^ F2(r, Km[13], Kr[13]);
t = l; l = r; r = t ^ F1(r, Km[12], Kr[12]);
t = l; l = r; r = t ^ F3(r, Km[11], Kr[11]);
t = l; l = r; r = t ^ F2(r, Km[10], Kr[10]);
t = l; l = r; r = t ^ F1(r, Km[9], Kr[9]);
t = l; l = r; r = t ^ F3(r, Km[8], Kr[8]);
t = l; l = r; r = t ^ F2(r, Km[7], Kr[7]);
t = l; l = r; r = t ^ F1(r, Km[6], Kr[6]);
t = l; l = r; r = t ^ F3(r, Km[5], Kr[5]);
t = l; l = r; r = t ^ F2(r, Km[4], Kr[4]);
t = l; l = r; r = t ^ F1(r, Km[3], Kr[3]);
t = l; l = r; r = t ^ F3(r, Km[2], Kr[2]);
t = l; l = r; r = t ^ F2(r, Km[1], Kr[1]);
t = l; l = r; r = t ^ F1(r, Km[0], Kr[0]);
} else {
t = l; l = r; r = t ^ F3(r, Km[11], Kr[11]);
t = l; l = r; r = t ^ F2(r, Km[10], Kr[10]);
t = l; l = r; r = t ^ F1(r, Km[9], Kr[9]);
t = l; l = r; r = t ^ F3(r, Km[8], Kr[8]);
t = l; l = r; r = t ^ F2(r, Km[7], Kr[7]);
t = l; l = r; r = t ^ F1(r, Km[6], Kr[6]);
t = l; l = r; r = t ^ F3(r, Km[5], Kr[5]);
t = l; l = r; r = t ^ F2(r, Km[4], Kr[4]);
t = l; l = r; r = t ^ F1(r, Km[3], Kr[3]);
t = l; l = r; r = t ^ F3(r, Km[2], Kr[2]);
t = l; l = r; r = t ^ F2(r, Km[1], Kr[1]);
t = l; l = r; r = t ^ F1(r, Km[0], Kr[0]);
}
dst[0] = cpu_to_be32(r);
dst[1] = cpu_to_be32(l);
}
示例9: main
int main()
{
auto a1 = F1();
auto a2 = F2();
auto a3 = F3();
auto a4 = F4();
auto a5 = F5();
return 0;
}
示例10: cast_decrypt
void
cast_decrypt(cast_key* key, u_int8_t* inblock, u_int8_t* outblock)
{
u_int32_t t, l, r;
/* Get inblock into l,r */
r = ((u_int32_t)inblock[0] << 24) | ((u_int32_t)inblock[1] << 16) |
((u_int32_t)inblock[2] << 8) | (u_int32_t)inblock[3];
l = ((u_int32_t)inblock[4] << 24) | ((u_int32_t)inblock[5] << 16) |
((u_int32_t)inblock[6] << 8) | (u_int32_t)inblock[7];
/* Do the work */
/* Only do full 16 rounds if key length > 80 bits */
if (key->rounds > 12) {
F1(r, l, 15);
F3(l, r, 14);
F2(r, l, 13);
F1(l, r, 12);
}
F3(r, l, 11);
F2(l, r, 10);
F1(r, l, 9);
F3(l, r, 8);
F2(r, l, 7);
F1(l, r, 6);
F3(r, l, 5);
F2(l, r, 4);
F1(r, l, 3);
F3(l, r, 2);
F2(r, l, 1);
F1(l, r, 0);
/* Put l,r into outblock */
outblock[0] = U8a(l);
outblock[1] = U8b(l);
outblock[2] = U8c(l);
outblock[3] = U8d(l);
outblock[4] = U8a(r);
outblock[5] = U8b(r);
outblock[6] = U8c(r);
outblock[7] = U8d(r);
/* Wipe clean */
t = l = r = 0;
}
示例11: CAST5decrypt
void
CAST5decrypt(const PGPUInt8 *in, PGPUInt8 *out, const PGPUInt32 *xkey)
{
PGPUInt32 l, r, t;
r = (PGPUInt32) in[0]<<24 | (PGPUInt32) in[1]<<16 |
(PGPUInt32) in[2]<<8 | in[3];
l = (PGPUInt32) in[4]<<24 | (PGPUInt32) in[5]<<16 |
(PGPUInt32) in[6]<<8 | in[7];
t = F1(l, xkey, 15); r ^= G1(t);
t = F3(r, xkey, 14); l ^= G3(t);
t = F2(l, xkey, 13); r ^= G2(t);
t = F1(r, xkey, 12); l ^= G1(t);
// Start here if only doing 12 rounds
t = F3(l, xkey, 11); r ^= G3(t);
t = F2(r, xkey, 10); l ^= G2(t);
t = F1(l, xkey, 9); r ^= G1(t);
t = F3(r, xkey, 8); l ^= G3(t);
t = F2(l, xkey, 7); r ^= G2(t);
t = F1(r, xkey, 6); l ^= G1(t);
t = F3(l, xkey, 5); r ^= G3(t);
t = F2(r, xkey, 4); l ^= G2(t);
t = F1(l, xkey, 3); r ^= G1(t);
t = F3(r, xkey, 2); l ^= G3(t);
t = F2(l, xkey, 1); r ^= G2(t);
t = F1(r, xkey, 0); l ^= G1(t);
out[0] = (PGPUInt8) B0(l);
out[1] = (PGPUInt8) B1(l);
out[2] = (PGPUInt8) B2(l);
out[3] = (PGPUInt8) B3(l);
out[4] = (PGPUInt8) B0(r);
out[5] = (PGPUInt8) B1(r);
out[6] = (PGPUInt8) B2(r);
out[7] = (PGPUInt8) B3(r);
}
示例12: Vector_Drive
void
Vector_Drive(vector V, double omega)
{
vector F1(-1.000,0.000), F2(0.500,-0.866), F3(0.866,0.500);
double omega1, omega2, omega3, b=0.090, r=0.020, h=0;
omega1 = ( F1*V + b*omega ) / r; // F1*V is overloaded dot product
omega2 = ( F2*V + b*omega ) / r;
omega3 = ( F3*V + b*omega ) / r;
// makes sure that given path is physically possible
if ( (omega1>6) || (omega2>6) || (omega3>6) || (omega1<-6) || (omega2<-6) || (omega3<-6) )
DisplayTxt("Vectors: ERROR!");
else
Drive(Vel_To_Value(omega1),Vel_To_Value(omega2),Vel_To_Value(omega3));
}
示例13: CAST5encrypt
/*
* Encrypt the 8 bytes at *in into the 8 bytes at *out using the expanded
* key schedule from *xkey.
*/
static void
CAST5encrypt(PGPByte const *in, PGPByte *out, PGPUInt32 const *xkey)
{
PGPUInt32 l, r, t;
l = (PGPUInt32)
in[0]<<24 | (PGPUInt32)in[1]<<16 | (PGPUInt32)in[2]<<8 | in[3];
r = (PGPUInt32)
in[4]<<24 | (PGPUInt32)in[5]<<16 | (PGPUInt32)in[6]<<8 | in[7];
t = F1(r, xkey, 0); l ^= G1(t);
t = F2(l, xkey, 1); r ^= G2(t);
t = F3(r, xkey, 2); l ^= G3(t);
t = F1(l, xkey, 3); r ^= G1(t);
t = F2(r, xkey, 4); l ^= G2(t);
t = F3(l, xkey, 5); r ^= G3(t);
t = F1(r, xkey, 6); l ^= G1(t);
t = F2(l, xkey, 7); r ^= G2(t);
t = F3(r, xkey, 8); l ^= G3(t);
t = F1(l, xkey, 9); r ^= G1(t);
t = F2(r, xkey, 10); l ^= G2(t);
t = F3(l, xkey, 11); r ^= G3(t);
/* Stop here if only doing 12 rounds */
t = F1(r, xkey, 12); l ^= G1(t);
t = F2(l, xkey, 13); r ^= G2(t);
t = F3(r, xkey, 14); l ^= G3(t);
t = F1(l, xkey, 15); r ^= G1(t);
out[0] = B0(r);
out[1] = B1(r);
out[2] = B2(r);
out[3] = B3(r);
out[4] = B0(l);
out[5] = B1(l);
out[6] = B2(l);
out[7] = B3(l);
}
示例14: QWidget
seconlevel_f4::seconlevel_f4(QWidget *parent) :
QWidget(parent),
ui(new Ui::seconlevel_f4)
{
ui->setupUi(this);
group = new GroupDialog(parent);
group->hide();
connect(group ,SIGNAL(finished(int)) ,this ,SLOT(f1_Done(int)));
autotab = new AutoDialog(parent);
autotab->hide();
connect(autotab ,SIGNAL(finished(int)) ,this ,SLOT(f2_Done(int)));
jump = new JumpDialog(parent);
jump->hide();
connect(jump ,SIGNAL(finished(int)) ,this ,SLOT(f6_Done(int)));
connect(ui->pushButton_F1,SIGNAL(clicked()),this ,SLOT(F1()));
ui->pushButton_F1->setCheckable(true);
connect(ui->pushButton_F2,SIGNAL(clicked()),this ,SLOT(F2()));
ui->pushButton_F2->setCheckable(true);
connect(ui->pushButton_F3,SIGNAL(clicked()),this ,SLOT(F3()));
ui->pushButton_F3->setCheckable(true);
connect(ui->pushButton_F4,SIGNAL(clicked()),this ,SLOT(F4()));
ui->pushButton_F4->setCheckable(true);
connect(ui->pushButton_F5,SIGNAL(clicked()),this ,SLOT(F5()));
ui->pushButton_F5->setCheckable(true);
connect(ui->pushButton_F6,SIGNAL(clicked()),this ,SLOT(F6()));
ui->pushButton_F6->setCheckable(true);
connect(ui->pushButton_F7,SIGNAL(clicked()),this ,SLOT(F7()));
ui->pushButton_F7->setCheckable(true);
connect(this ,SIGNAL(enter(int)),parent ,SLOT(funcbarUpdate(int)));
connect(ui->pushButton_F8,SIGNAL(clicked()),this ,SLOT(F8()));
/*数据表模式改变信号*/
connect(this ,SIGNAL(stateChange(char)) ,parent ,SLOT(tableStateUpdate(char)));
/*段选信号*/
connect(this ,SIGNAL(selectRows(bool)) ,parent ,SLOT(tableSelect(bool)));
setFocusPolicy(Qt::NoFocus);
}
示例15: test_main
int test_main(int,char *[])
{
bu::quantity<mixed_length> a1(2.0 * mixed_length());
bu::quantity<si_area> a2(a1);
BOOST_CHECK((std::abs(a2.value() - .02) < .0001));
bu::quantity<mixed_length> a3(a2);
BOOST_CHECK((std::abs(a3.value() - 2.0) < .0001));
bu::quantity<mixed_energy_1> e1(2.0 * mixed_energy_1());
bu::quantity<mixed_energy_2> e2(e1);
BOOST_CHECK((std::abs(e2.value() - 20.0) < .0001));
bu::quantity<bu::si::energy> e3(e1);
BOOST_CHECK((std::abs(e3.value() - .0002) < .0001));
bu::quantity<mixed_energy_2> e4(e3);
BOOST_CHECK((std::abs(e4.value() - 20.0) < .0001));
bu::quantity<bu::cgs::force> F0 = 20 * bu::cgs::dyne;
BOOST_CHECK((std::abs(F0.value() - 20.0) < .0001));
bu::quantity<bu::si::force> F3(F0);
BOOST_CHECK((std::abs(F3.value() - 2.0e-4) < .000000001));
bu::quantity<bu::si::force> F5(20 * bu::cgs::dyne);
BOOST_CHECK((std::abs(F5.value() - 2.0e-4) < .000000001));
bu::quantity<bu::si::dimensionless> dimensionless_test1(1.0*bu::cgs::dyne/bu::si::newton);
BOOST_CHECK(dimensionless_test1 == 1e-5);
typedef bu::multiply_typeof_helper<bu::si::length, bu::cgs::length>::type m_cm;
typedef bu::divide_typeof_helper<m_cm, m_cm>::type heterogeneous_dimensionless;
bu::quantity<heterogeneous_dimensionless> dimensionless_test2(1.0*bu::cgs::dyne/bu::si::newton);
BOOST_CHECK(dimensionless_test2.value() == 1e-5);
bu::quantity<bu::divide_typeof_helper<bu::cgs::force, bu::si::force>::type> dimensionless_test3(dimensionless_test2);
BOOST_UNITS_CHECK_CLOSE(dimensionless_test3.value(), 1.0);
//m/cm -> g/kg
bu::quantity<bu::divide_typeof_helper<bu::si::length, bu::cgs::length>::type> dimensionless_test4(2.0 * bu::si::meters / bu::cgs::centimeters);
bu::quantity<bu::divide_typeof_helper<bu::cgs::mass, bu::si::mass>::type> dimensionless_test5(dimensionless_test4);
BOOST_UNITS_CHECK_CLOSE(dimensionless_test5.value(), 2e5);
return(0);
}