导航:首页 > 源码编译 > ids4源码

ids4源码

发布时间:2023-12-02 15:29:54

① 求C语言编写的DES加密解密源代码

从别的地方抄来的
http://hi..com/493168771/blog/item/5816b034ca19fc44251f144c.html

#include "stdio.h"

#include "time.h"

#include "stdlib.h"

#define PLAIN_FILE_OPEN_ERROR -1

#define KEY_FILE_OPEN_ERROR -2

#define CIPHER_FILE_OPEN_ERROR -3

#define OK 1;

typedef char ElemType;

/* 初始置换表IP */

int IP_Table[64] = { 57,49,41,33,25,17,9,1,

59,51,43,35,27,19,11,3,

61,53,45,37,29,21,13,5,

63,55,47,39,31,23,15,7,

56,48,40,32,24,16,8,0,

58,50,42,34,26,18,10,2,

60,52,44,36,28,20,12,4,

62,54,46,38,30,22,14,6};

/* 逆初始置换表IP^-1 */

int IP_1_Table[64] = {39,7,47,15,55,23,63,31,

38,6,46,14,54,22,62,30,

37,5,45,13,53,21,61,29,

36,4,44,12,52,20,60,28,

35,3,43,11,51,19,59,27,

34,2,42,10,50,18,58,26,

33,1,41,9,49,17,57,25,

32,0,40,8,48,16,56,24};

/* 扩充置换表E */

int E_Table[48] = {31, 0, 1, 2, 3, 4,

3, 4, 5, 6, 7, 8,

7, 8,9,10,11,12,

11,12,13,14,15,16,

15,16,17,18,19,20,

19,20,21,22,23,24,

23,24,25,26,27,28,

27,28,29,30,31, 0};

/* 置换函数P */

int P_Table[32] = {15,6,19,20,28,11,27,16,

0,14,22,25,4,17,30,9,

1,7,23,13,31,26,2,8,

18,12,29,5,21,10,3,24};

/* S盒 */

int S[8][4][16] =/* S1 */

{{{14,4,13,1,2,15,11,8,3,10,6,12,5,9,0,7},

{0,15,7,4,14,2,13,1,10,6,12,11,9,5,3,8},

{4,1,14,8,13,6,2,11,15,12,9,7,3,10,5,0},

{15,12,8,2,4,9,1,7,5,11,3,14,10,0,6,13}},

/* S2 */

{{15,1,8,14,6,11,3,4,9,7,2,13,12,0,5,10},

{3,13,4,7,15,2,8,14,12,0,1,10,6,9,11,5},

{0,14,7,11,10,4,13,1,5,8,12,6,9,3,2,15},

{13,8,10,1,3,15,4,2,11,6,7,12,0,5,14,9}},

/* S3 */

{{10,0,9,14,6,3,15,5,1,13,12,7,11,4,2,8},

{13,7,0,9,3,4,6,10,2,8,5,14,12,11,15,1},

{13,6,4,9,8,15,3,0,11,1,2,12,5,10,14,7},

{1,10,13,0,6,9,8,7,4,15,14,3,11,5,2,12}},

/* S4 */

{{7,13,14,3,0,6,9,10,1,2,8,5,11,12,4,15},

{13,8,11,5,6,15,0,3,4,7,2,12,1,10,14,9},

{10,6,9,0,12,11,7,13,15,1,3,14,5,2,8,4},

{3,15,0,6,10,1,13,8,9,4,5,11,12,7,2,14}},

/* S5 */

{{2,12,4,1,7,10,11,6,8,5,3,15,13,0,14,9},

{14,11,2,12,4,7,13,1,5,0,15,10,3,9,8,6},

{4,2,1,11,10,13,7,8,15,9,12,5,6,3,0,14},

{11,8,12,7,1,14,2,13,6,15,0,9,10,4,5,3}},

/* S6 */

{{12,1,10,15,9,2,6,8,0,13,3,4,14,7,5,11},

{10,15,4,2,7,12,9,5,6,1,13,14,0,11,3,8},

{9,14,15,5,2,8,12,3,7,0,4,10,1,13,11,6},

{4,3,2,12,9,5,15,10,11,14,1,7,6,0,8,13}},

/* S7 */

{{4,11,2,14,15,0,8,13,3,12,9,7,5,10,6,1},

{13,0,11,7,4,9,1,10,14,3,5,12,2,15,8,6},

{1,4,11,13,12,3,7,14,10,15,6,8,0,5,9,2},

{6,11,13,8,1,4,10,7,9,5,0,15,14,2,3,12}},

/* S8 */

{{13,2,8,4,6,15,11,1,10,9,3,14,5,0,12,7},

{1,15,13,8,10,3,7,4,12,5,6,11,0,14,9,2},

{7,11,4,1,9,12,14,2,0,6,10,13,15,3,5,8},

{2,1,14,7,4,10,8,13,15,12,9,0,3,5,6,11}}};

/* 置换选择1 */

int PC_1[56] = {56,48,40,32,24,16,8,

0,57,49,41,33,25,17,

9,1,58,50,42,34,26,

18,10,2,59,51,43,35,

62,54,46,38,30,22,14,

6,61,53,45,37,29,21,

13,5,60,52,44,36,28,

20,12,4,27,19,11,3};

/* 置换选择2 */

int PC_2[48] = {13,16,10,23,0,4,2,27,

14,5,20,9,22,18,11,3,

25,7,15,6,26,19,12,1,

40,51,30,36,46,54,29,39,

50,44,32,46,43,48,38,55,

33,52,45,41,49,35,28,31};

/* 对左移次数的规定 */

int MOVE_TIMES[16] = {1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1};

int ByteToBit(ElemType ch,ElemType bit[8]);

int BitToByte(ElemType bit[8],ElemType *ch);

int Char8ToBit64(ElemType ch[8],ElemType bit[64]);

int Bit64ToChar8(ElemType bit[64],ElemType ch[8]);

int DES_MakeSubKeys(ElemType key[64],ElemType subKeys[16][48]);

int DES_PC1_Transform(ElemType key[64], ElemType tempbts[56]);

int DES_PC2_Transform(ElemType key[56], ElemType tempbts[48]);

int DES_ROL(ElemType data[56], int time);

int DES_IP_Transform(ElemType data[64]);

int DES_IP_1_Transform(ElemType data[64]);

int DES_E_Transform(ElemType data[48]);

int DES_P_Transform(ElemType data[32]);

int DES_SBOX(ElemType data[48]);

int DES_XOR(ElemType R[48], ElemType L[48],int count);

int DES_Swap(ElemType left[32],ElemType right[32]);

int DES_EncryptBlock(ElemType plainBlock[8], ElemType subKeys[16][48], ElemType cipherBlock[8]);

int DES_DecryptBlock(ElemType cipherBlock[8], ElemType subKeys[16][48], ElemType plainBlock[8]);

int DES_Encrypt(char *plainFile, char *keyStr,char *cipherFile);

int DES_Decrypt(char *cipherFile, char *keyStr,char *plainFile);

/* 字节转换成二进制 */

int ByteToBit(ElemType ch, ElemType bit[8]){

int cnt;

for(cnt = 0;cnt < 8; cnt++){

*(bit+cnt) = (ch>>cnt)&1;

}

return 0;

}

/* 二进制转换成字节 */

int BitToByte(ElemType bit[8],ElemType *ch){

int cnt;

for(cnt = 0;cnt < 8; cnt++){

*ch |= *(bit + cnt)<<cnt;

}

return 0;

}

/* 将长度为8的字符串转为二进制位串 */

int Char8ToBit64(ElemType ch[8],ElemType bit[64]){

int cnt;

for(cnt = 0; cnt < 8; cnt++){

ByteToBit(*(ch+cnt),bit+(cnt<<3));

}

return 0;

}

/* 将二进制位串转为长度为8的字符串 */

int Bit64ToChar8(ElemType bit[64],ElemType ch[8]){

int cnt;

memset(ch,0,8);

for(cnt = 0; cnt < 8; cnt++){

BitToByte(bit+(cnt<<3),ch+cnt);

}

return 0;

}

/* 生成子密钥 */

int DES_MakeSubKeys(ElemType key[64],ElemType subKeys[16][48]){

ElemType temp[56];

int cnt;

DES_PC1_Transform(key,temp);/* PC1置换 */

for(cnt = 0; cnt < 16; cnt++){/* 16轮跌代,产生16个子密钥 */

DES_ROL(temp,MOVE_TIMES[cnt]);/* 循环左移 */

DES_PC2_Transform(temp,subKeys[cnt]);/* PC2置换,产生子密钥 */

}

return 0;

}

/* 密钥置换1 */

int DES_PC1_Transform(ElemType key[64], ElemType tempbts[56]){

int cnt;

for(cnt = 0; cnt < 56; cnt++){

tempbts[cnt] = key[PC_1[cnt]];

}

return 0;

}

/* 密钥置换2 */

int DES_PC2_Transform(ElemType key[56], ElemType tempbts[48]){

int cnt;

for(cnt = 0; cnt < 48; cnt++){

tempbts[cnt] = key[PC_2[cnt]];

}

return 0;

}

/* 循环左移 */

int DES_ROL(ElemType data[56], int time){

ElemType temp[56];

/* 保存将要循环移动到右边的位 */

memcpy(temp,data,time);

memcpy(temp+time,data+28,time);

/* 前28位移动 */

memcpy(data,data+time,28-time);

memcpy(data+28-time,temp,time);

/* 后28位移动 */

memcpy(data+28,data+28+time,28-time);

memcpy(data+56-time,temp+time,time);

return 0;

}

/* IP置换 */

int DES_IP_Transform(ElemType data[64]){

int cnt;

ElemType temp[64];

for(cnt = 0; cnt < 64; cnt++){

temp[cnt] = data[IP_Table[cnt]];

}

memcpy(data,temp,64);

return 0;

}

/* IP逆置换 */

int DES_IP_1_Transform(ElemType data[64]){

int cnt;

ElemType temp[64];

for(cnt = 0; cnt < 64; cnt++){

temp[cnt] = data[IP_1_Table[cnt]];

}

memcpy(data,temp,64);

return 0;

}

/* 扩展置换 */

int DES_E_Transform(ElemType data[48]){

int cnt;

ElemType temp[48];

for(cnt = 0; cnt < 48; cnt++){

temp[cnt] = data[E_Table[cnt]];

}

memcpy(data,temp,48);

return 0;

}

/* P置换 */

int DES_P_Transform(ElemType data[32]){

int cnt;

ElemType temp[32];

for(cnt = 0; cnt < 32; cnt++){

temp[cnt] = data[P_Table[cnt]];

}

memcpy(data,temp,32);

return 0;

}

/* 异或 */

int DES_XOR(ElemType R[48], ElemType L[48] ,int count){

int cnt;

for(cnt = 0; cnt < count; cnt++){

R[cnt] ^= L[cnt];

}

return 0;

}

/* S盒置换 */

int DES_SBOX(ElemType data[48]){

int cnt;

int line,row,output;

int cur1,cur2;

for(cnt = 0; cnt < 8; cnt++){

cur1 = cnt*6;

cur2 = cnt<<2;

/* 计算在S盒中的行与列 */

line = (data[cur1]<<1) + data[cur1+5];

row = (data[cur1+1]<<3) + (data[cur1+2]<<2)

+ (data[cur1+3]<<1) + data[cur1+4];

output = S[cnt][line][row];

/* 化为2进制 */

data[cur2] = (output&0X08)>>3;

data[cur2+1] = (output&0X04)>>2;

data[cur2+2] = (output&0X02)>>1;

data[cur2+3] = output&0x01;

}

return 0;

}

/* 交换 */

int DES_Swap(ElemType left[32], ElemType right[32]){

ElemType temp[32];

memcpy(temp,left,32);

memcpy(left,right,32);

memcpy(right,temp,32);

return 0;

}

/* 加密单个分组 */

int DES_EncryptBlock(ElemType plainBlock[8], ElemType subKeys[16][48], ElemType cipherBlock[8]){

ElemType plainBits[64];

ElemType Right[48];

int cnt;

Char8ToBit64(plainBlock,plainBits);

/* 初始置换(IP置换) */

DES_IP_Transform(plainBits);

/* 16轮迭代 */

for(cnt = 0; cnt < 16; cnt++){

memcpy(Right,plainBits+32,32);

/* 将右半部分进行扩展置换,从32位扩展到48位 */

DES_E_Transform(Right);

/* 将右半部分与子密钥进行异或操作 */

DES_XOR(Right,subKeys[cnt],48);

/* 异或结果进入S盒,输出32位结果 */

DES_SBOX(Right);

/* P置换 */

DES_P_Transform(Right);

/* 将明文左半部分与右半部分进行异或 */

DES_XOR(plainBits,Right,32);

if(cnt != 15){

/* 最终完成左右部的交换 */

DES_Swap(plainBits,plainBits+32);

}

}

/* 逆初始置换(IP^1置换) */

DES_IP_1_Transform(plainBits);

Bit64ToChar8(plainBits,cipherBlock);

return 0;

}

/* 解密单个分组 */

int DES_DecryptBlock(ElemType cipherBlock[8], ElemType subKeys[16][48],ElemType plainBlock[8]){

ElemType cipherBits[64];

ElemType Right[48];

int cnt;

Char8ToBit64(cipherBlock,cipherBits);

/* 初始置换(IP置换) */

DES_IP_Transform(cipherBits);

/* 16轮迭代 */

for(cnt = 15; cnt >= 0; cnt--){

memcpy(Right,cipherBits+32,32);

/* 将右半部分进行扩展置换,从32位扩展到48位 */

DES_E_Transform(Right);

/* 将右半部分与子密钥进行异或操作 */

DES_XOR(Right,subKeys[cnt],48);

/* 异或结果进入S盒,输出32位结果 */

DES_SBOX(Right);

/* P置换 */

DES_P_Transform(Right);

/* 将明文左半部分与右半部分进行异或 */

DES_XOR(cipherBits,Right,32);

if(cnt != 0){

/* 最终完成左右部的交换 */

DES_Swap(cipherBits,cipherBits+32);

}

}

/* 逆初始置换(IP^1置换) */

DES_IP_1_Transform(cipherBits);

Bit64ToChar8(cipherBits,plainBlock);

return 0;

}

/* 加密文件 */

int DES_Encrypt(char *plainFile, char *keyStr,char *cipherFile){

FILE *plain,*cipher;

int count;

ElemType plainBlock[8],cipherBlock[8],keyBlock[8];

ElemType bKey[64];

ElemType subKeys[16][48];

if((plain = fopen(plainFile,"rb")) == NULL){

return PLAIN_FILE_OPEN_ERROR;

}

if((cipher = fopen(cipherFile,"wb")) == NULL){

return CIPHER_FILE_OPEN_ERROR;

}

/* 设置密钥 */

memcpy(keyBlock,keyStr,8);

/* 将密钥转换为二进制流 */

Char8ToBit64(keyBlock,bKey);

/* 生成子密钥 */

DES_MakeSubKeys(bKey,subKeys);

while(!feof(plain)){

/* 每次读8个字节,并返回成功读取的字节数 */

if((count = fread(plainBlock,sizeof(char),8,plain)) == 8){

DES_EncryptBlock(plainBlock,subKeys,cipherBlock);

fwrite(cipherBlock,sizeof(char),8,cipher);

}

}

if(count){

/* 填充 */

memset(plainBlock + count,'\0',7 - count);

/* 最后一个字符保存包括最后一个字符在内的所填充的字符数量 */

plainBlock[7] = 8 - count;

DES_EncryptBlock(plainBlock,subKeys,cipherBlock);

fwrite(cipherBlock,sizeof(char),8,cipher);

}

fclose(plain);

fclose(cipher);

return OK;

}

/* 解密文件 */

int DES_Decrypt(char *cipherFile, char *keyStr,char *plainFile){

FILE *plain, *cipher;

int count,times = 0;

long fileLen;

ElemType plainBlock[8],cipherBlock[8],keyBlock[8];

ElemType bKey[64];

ElemType subKeys[16][48];

if((cipher = fopen(cipherFile,"rb")) == NULL){

return CIPHER_FILE_OPEN_ERROR;

}

if((plain = fopen(plainFile,"wb")) == NULL){

return PLAIN_FILE_OPEN_ERROR;

}

/* 设置密钥 */

memcpy(keyBlock,keyStr,8);

/* 将密钥转换为二进制流 */

Char8ToBit64(keyBlock,bKey);

/* 生成子密钥 */

DES_MakeSubKeys(bKey,subKeys);

/* 取文件长度 */

fseek(cipher,0,SEEK_END); /* 将文件指针置尾 */

fileLen = ftell(cipher); /* 取文件指针当前位置 */

rewind(cipher); /* 将文件指针重指向文件头 */

while(1){

/* 密文的字节数一定是8的整数倍 */

fread(cipherBlock,sizeof(char),8,cipher);

DES_DecryptBlock(cipherBlock,subKeys,plainBlock);

times += 8;

if(times < fileLen){

fwrite(plainBlock,sizeof(char),8,plain);

}

else{

break;

}

}

/* 判断末尾是否被填充 */

if(plainBlock[7] < 8){

for(count = 8 - plainBlock[7]; count < 7; count++){

if(plainBlock[count] != '\0'){

break;

}

}

}

if(count == 7){/* 有填充 */

fwrite(plainBlock,sizeof(char),8 - plainBlock[7],plain);

}

else{/* 无填充 */

fwrite(plainBlock,sizeof(char),8,plain);

}

fclose(plain);

fclose(cipher);

return OK;

}

int main()

{ DES_Encrypt("1.txt","key.txt","2.txt");
system("pause");
DES_Decrypt("2.txt","key.txt","3.txt");

getchar();

return 0;

}

② des算法源代码

des.h文件:
#ifndef CRYPTOPP_DES_H
#define CRYPTOPP_DES_H

#include "cryptlib.h"
#include "misc.h"

NAMESPACE_BEGIN(CryptoPP)

class DES : public BlockTransformation
{
public:
DES(const byte *userKey, CipherDir);

void ProcessBlock(const byte *inBlock, byte * outBlock) const;
void ProcessBlock(byte * inoutBlock) const
{DES::ProcessBlock(inoutBlock, inoutBlock);}

enum {KEYLENGTH=8, BLOCKSIZE=8};
unsigned int BlockSize() const {return BLOCKSIZE;}

protected:
static const word32 Spbox[8][64];

SecBlock<word32> k;
};

class DESEncryption : public DES
{
public:
DESEncryption(const byte * userKey)
: DES (userKey, ENCRYPTION) {}
};

class DESDecryption : public DES
{
public:
DESDecryption(const byte * userKey)
: DES (userKey, DECRYPTION) {}
};

class DES_EDE_Encryption : public BlockTransformation
{
public:
DES_EDE_Encryption(const byte * userKey)
: e(userKey, ENCRYPTION), d(userKey + DES::KEYLENGTH, DECRYPTION) {}

void ProcessBlock(const byte *inBlock, byte * outBlock) const;
void ProcessBlock(byte * inoutBlock) const;

enum {KEYLENGTH=16, BLOCKSIZE=8};
unsigned int BlockSize() const {return BLOCKSIZE;}

private:
DES e, d;
};

class DES_EDE_Decryption : public BlockTransformation
{
public:
DES_EDE_Decryption(const byte * userKey)
: d(userKey, DECRYPTION), e(userKey + DES::KEYLENGTH, ENCRYPTION) {}

void ProcessBlock(const byte *inBlock, byte * outBlock) const;
void ProcessBlock(byte * inoutBlock) const;

enum {KEYLENGTH=16, BLOCKSIZE=8};
unsigned int BlockSize() const {return BLOCKSIZE;}

private:
DES d, e;
};

class TripleDES_Encryption : public BlockTransformation
{
public:
TripleDES_Encryption(const byte * userKey)
: e1(userKey, ENCRYPTION), d(userKey + DES::KEYLENGTH, DECRYPTION),
e2(userKey + 2*DES::KEYLENGTH, ENCRYPTION) {}

void ProcessBlock(const byte *inBlock, byte * outBlock) const;
void ProcessBlock(byte * inoutBlock) const;

enum {KEYLENGTH=24, BLOCKSIZE=8};
unsigned int BlockSize() const {return BLOCKSIZE;}

private:
DES e1, d, e2;
};

class TripleDES_Decryption : public BlockTransformation
{
public:
TripleDES_Decryption(const byte * userKey)
: d1(userKey + 2*DES::KEYLENGTH, DECRYPTION), e(userKey + DES::KEYLENGTH, ENCRYPTION),
d2(userKey, DECRYPTION) {}

void ProcessBlock(const byte *inBlock, byte * outBlock) const;
void ProcessBlock(byte * inoutBlock) const;

enum {KEYLENGTH=24, BLOCKSIZE=8};
unsigned int BlockSize() const {return BLOCKSIZE;}

private:
DES d1, e, d2;
};

NAMESPACE_END

#endif

des.cpp文件:
// des.cpp - modified by Wei Dai from:

/*
* This is a major rewrite of my old public domain DES code written
* circa 1987, which in turn borrowed heavily from Jim Gillogly's 1977
* public domain code. I pretty much kept my key scheling code, but
* the actual encrypt/decrypt routines are taken from from Richard
* Outerbridge's DES code as printed in Schneier's "Applied Cryptography."
*
* This code is in the public domain. I would appreciate bug reports and
* enhancements.
*
* Phil Karn KA9Q, [email protected], August 1994.
*/

#include "pch.h"
#include "misc.h"
#include "des.h"

NAMESPACE_BEGIN(CryptoPP)

/* Tables defined in the Data Encryption Standard documents
* Three of these tables, the initial permutation, the final
* permutation and the expansion operator, are regular enough that
* for speed, we hard-code them. They're here for reference only.
* Also, the S and P boxes are used by a separate program, gensp.c,
* to build the combined SP box, Spbox[]. They're also here just
* for reference.
*/
#ifdef notdef
/* initial permutation IP */
static byte ip[] = {
58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6,
64, 56, 48, 40, 32, 24, 16, 8,
57, 49, 41, 33, 25, 17, 9, 1,
59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5,
63, 55, 47, 39, 31, 23, 15, 7
};

/* final permutation IP^-1 */
static byte fp[] = {
40, 8, 48, 16, 56, 24, 64, 32,
39, 7, 47, 15, 55, 23, 63, 31,
38, 6, 46, 14, 54, 22, 62, 30,
37, 5, 45, 13, 53, 21, 61, 29,
36, 4, 44, 12, 52, 20, 60, 28,
35, 3, 43, 11, 51, 19, 59, 27,
34, 2, 42, 10, 50, 18, 58, 26,
33, 1, 41, 9, 49, 17, 57, 25
};
/* expansion operation matrix */
static byte ei[] = {
32, 1, 2, 3, 4, 5,
4, 5, 6, 7, 8, 9,
8, 9, 10, 11, 12, 13,
12, 13, 14, 15, 16, 17,
16, 17, 18, 19, 20, 21,
20, 21, 22, 23, 24, 25,
24, 25, 26, 27, 28, 29,
28, 29, 30, 31, 32, 1
};
/* The (in)famous S-boxes */
static byte sbox[8][64] = {
/* S1 */
14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13,

/* S2 */
15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9,

/* S3 */
10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1,
13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7,
1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12,

/* S4 */
7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9,
10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4,
3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14,

/* S5 */
2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6,
4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14,
11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3,

/* S6 */
12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8,
9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6,
4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13,

/* S7 */
4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6,
1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2,
6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12,

/* S8 */
13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11
};

/* 32-bit permutation function P used on the output of the S-boxes */
static byte p32i[] = {
16, 7, 20, 21,
29, 12, 28, 17,
1, 15, 23, 26,
5, 18, 31, 10,
2, 8, 24, 14,
32, 27, 3, 9,
19, 13, 30, 6,
22, 11, 4, 25
};
#endif

/* permuted choice table (key) */
static const byte pc1[] = {
57, 49, 41, 33, 25, 17, 9,
1, 58, 50, 42, 34, 26, 18,
10, 2, 59, 51, 43, 35, 27,
19, 11, 3, 60, 52, 44, 36,

63, 55, 47, 39, 31, 23, 15,
7, 62, 54, 46, 38, 30, 22,
14, 6, 61, 53, 45, 37, 29,
21, 13, 5, 28, 20, 12, 4
};

/* number left rotations of pc1 */
static const byte totrot[] = {
1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28
};

/* permuted choice key (table) */
static const byte pc2[] = {
14, 17, 11, 24, 1, 5,
3, 28, 15, 6, 21, 10,
23, 19, 12, 4, 26, 8,
16, 7, 27, 20, 13, 2,
41, 52, 31, 37, 47, 55,
30, 40, 51, 45, 33, 48,
44, 49, 39, 56, 34, 53,
46, 42, 50, 36, 29, 32
};

/* End of DES-defined tables */

/* bit 0 is left-most in byte */
static const int bytebit[] = {
0200,0100,040,020,010,04,02,01
};

/* Set key (initialize key schele array) */
DES::DES(const byte *key, CipherDir dir)
: k(32)
{
SecByteBlock buffer(56+56+8);
byte *const pc1m=buffer; /* place to modify pc1 into */
byte *const pcr=pc1m+56; /* place to rotate pc1 into */
byte *const ks=pcr+56;
register int i,j,l;
int m;

for (j=0; j<56; j++) { /* convert pc1 to bits of key */
l=pc1[j]-1; /* integer bit location */
m = l & 07; /* find bit */
pc1m[j]=(key[l>>3] & /* find which key byte l is in */
bytebit[m]) /* and which bit of that byte */
? 1 : 0; /* and store 1-bit result */
}
for (i=0; i<16; i++) { /* key chunk for each iteration */
memset(ks,0,8); /* Clear key schele */
for (j=0; j<56; j++) /* rotate pc1 the right amount */
pcr[j] = pc1m[(l=j+totrot[i])<(j<28? 28 : 56) ? l: l-28];
/* rotate left and right halves independently */
for (j=0; j<48; j++){ /* select bits indivially */
/* check bit that goes to ks[j] */
if (pcr[pc2[j]-1]){
/* mask it in if it's there */
l= j % 6;
ks[j/6] |= bytebit[l] >> 2;
}
}
/* Now convert to odd/even interleaved form for use in F */
k[2*i] = ((word32)ks[0] << 24)
| ((word32)ks[2] << 16)
| ((word32)ks[4] << 8)
| ((word32)ks[6]);
k[2*i+1] = ((word32)ks[1] << 24)
| ((word32)ks[3] << 16)
| ((word32)ks[5] << 8)
| ((word32)ks[7]);
}

if (dir==DECRYPTION) // reverse key schele order
for (i=0; i<16; i+=2)
{
std::swap(k[i], k[32-2-i]);
std::swap(k[i+1], k[32-1-i]);
}
}
/* End of C code common to both versions */

/* C code only in portable version */

// Richard Outerbridge's initial permutation algorithm
/*
inline void IPERM(word32 &left, word32 &right)
{
word32 work;

work = ((left >> 4) ^ right) & 0x0f0f0f0f;
right ^= work;
left ^= work << 4;
work = ((left >> 16) ^ right) & 0xffff;
right ^= work;
left ^= work << 16;
work = ((right >> 2) ^ left) & 0x33333333;
left ^= work;
right ^= (work << 2);
work = ((right >> 8) ^ left) & 0xff00ff;
left ^= work;
right ^= (work << 8);
right = rotl(right, 1);
work = (left ^ right) & 0xaaaaaaaa;
left ^= work;
right ^= work;
left = rotl(left, 1);
}
inline void FPERM(word32 &left, word32 &right)
{
word32 work;

right = rotr(right, 1);
work = (left ^ right) & 0xaaaaaaaa;
left ^= work;
right ^= work;
left = rotr(left, 1);
work = ((left >> 8) ^ right) & 0xff00ff;
right ^= work;
left ^= work << 8;
work = ((left >> 2) ^ right) & 0x33333333;
right ^= work;
left ^= work << 2;
work = ((right >> 16) ^ left) & 0xffff;
left ^= work;
right ^= work << 16;
work = ((right >> 4) ^ left) & 0x0f0f0f0f;
left ^= work;
right ^= work << 4;
}
*/

// Wei Dai's modification to Richard Outerbridge's initial permutation
// algorithm, this one is faster if you have access to rotate instructions
// (like in MSVC)
inline void IPERM(word32 &left, word32 &right)
{
word32 work;

right = rotl(right, 4U);
work = (left ^ right) & 0xf0f0f0f0;
left ^= work;
right = rotr(right^work, 20U);
work = (left ^ right) & 0xffff0000;
left ^= work;
right = rotr(right^work, 18U);
work = (left ^ right) & 0x33333333;
left ^= work;
right = rotr(right^work, 6U);
work = (left ^ right) & 0x00ff00ff;
left ^= work;
right = rotl(right^work, 9U);
work = (left ^ right) & 0xaaaaaaaa;
left = rotl(left^work, 1U);
right ^= work;
}

inline void FPERM(word32 &left, word32 &right)
{
word32 work;

right = rotr(right, 1U);
work = (left ^ right) & 0xaaaaaaaa;
right ^= work;
left = rotr(left^work, 9U);
work = (left ^ right) & 0x00ff00ff;
right ^= work;
left = rotl(left^work, 6U);
work = (left ^ right) & 0x33333333;
right ^= work;
left = rotl(left^work, 18U);
work = (left ^ right) & 0xffff0000;
right ^= work;
left = rotl(left^work, 20U);
work = (left ^ right) & 0xf0f0f0f0;
right ^= work;
left = rotr(left^work, 4U);
}

// Encrypt or decrypt a block of data in ECB mode
void DES::ProcessBlock(const byte *inBlock, byte * outBlock) const
{
word32 l,r,work;

#ifdef IS_LITTLE_ENDIAN
l = byteReverse(*(word32 *)inBlock);
r = byteReverse(*(word32 *)(inBlock+4));
#else
l = *(word32 *)inBlock;
r = *(word32 *)(inBlock+4);
#endif

IPERM(l,r);

const word32 *kptr=k;

for (unsigned i=0; i<8; i++)
{
work = rotr(r, 4U) ^ kptr[4*i+0];
l ^= Spbox[6][(work) & 0x3f]
^ Spbox[4][(work >> 8) & 0x3f]
^ Spbox[2][(work >> 16) & 0x3f]
^ Spbox[0][(work >> 24) & 0x3f];
work = r ^ kptr[4*i+1];
l ^= Spbox[7][(work) & 0x3f]
^ Spbox[5][(work >> 8) & 0x3f]
^ Spbox[3][(work >> 16) & 0x3f]
^ Spbox[1][(work >> 24) & 0x3f];

work = rotr(l, 4U) ^ kptr[4*i+2];
r ^= Spbox[6][(work) & 0x3f]
^ Spbox[4][(work >> 8) & 0x3f]
^ Spbox[2][(work >> 16) & 0x3f]
^ Spbox[0][(work >> 24) & 0x3f];
work = l ^ kptr[4*i+3];
r ^= Spbox[7][(work) & 0x3f]
^ Spbox[5][(work >> 8) & 0x3f]
^ Spbox[3][(work >> 16) & 0x3f]
^ Spbox[1][(work >> 24) & 0x3f];
}

FPERM(l,r);

#ifdef IS_LITTLE_ENDIAN
*(word32 *)outBlock = byteReverse(r);
*(word32 *)(outBlock+4) = byteReverse(l);
#else
*(word32 *)outBlock = r;
*(word32 *)(outBlock+4) = l;
#endif
}

void DES_EDE_Encryption::ProcessBlock(byte *inoutBlock) const
{
e.ProcessBlock(inoutBlock);
d.ProcessBlock(inoutBlock);
e.ProcessBlock(inoutBlock);
}

void DES_EDE_Encryption::ProcessBlock(const byte *inBlock, byte *outBlock) const
{
e.ProcessBlock(inBlock, outBlock);
d.ProcessBlock(outBlock);
e.ProcessBlock(outBlock);
}

void DES_EDE_Decryption::ProcessBlock(byte *inoutBlock) const
{
d.ProcessBlock(inoutBlock);
e.ProcessBlock(inoutBlock);
d.ProcessBlock(inoutBlock);
}

void DES_EDE_Decryption::ProcessBlock(const byte *inBlock, byte *outBlock) const
{
d.ProcessBlock(inBlock, outBlock);
e.ProcessBlock(outBlock);
d.ProcessBlock(outBlock);
}

void TripleDES_Encryption::ProcessBlock(byte *inoutBlock) const
{
e1.ProcessBlock(inoutBlock);
d.ProcessBlock(inoutBlock);
e2.ProcessBlock(inoutBlock);
}

void TripleDES_Encryption::ProcessBlock(const byte *inBlock, byte *outBlock) const
{
e1.ProcessBlock(inBlock, outBlock);
d.ProcessBlock(outBlock);
e2.ProcessBlock(outBlock);
}

void TripleDES_Decryption::ProcessBlock(byte *inoutBlock) const
{
d1.ProcessBlock(inoutBlock);
e.ProcessBlock(inoutBlock);
d2.ProcessBlock(inoutBlock);
}

void TripleDES_Decryption::ProcessBlock(const byte *inBlock, byte *outBlock) const
{
d1.ProcessBlock(inBlock, outBlock);
e.ProcessBlock(outBlock);
d2.ProcessBlock(outBlock);
}

NAMESPACE_END

③ 求任何网络游戏源码

魔兽世界的

④ 股市当中有哪些好用的指标,带源码的

指标不是万能的,不是万能钥匙,灵丹妙药,指标五花八门,林林总总,不计其数。每一类指标只能反映股票运行规律的一个侧面。

我自以为是的适合自己的好用的主图指标如下:

DRAWKLINE(H,O,L,C);

涨停1:=(C/REF(C,1))>=1.095 AND (C/REF(C,1))<=1.105;

STICKLINE(涨停1,O,C,4,0),COLORYELLOW;

涨停2:=(C/REF(C,1))>1.105 AND (C/REF(C,1))<=1.195;

STICKLINE(涨停2,O,C,4,0),COLORLIRED;

涨停3:=(C/REF(C,1))>1.195 ;

STICKLINE(涨停3,O,C,4,0),COLORMAGENTA;

EXPMA17:EXPMEMA(C,17)COLORMAGENTA LINETHICK2;

MA55:MA(C,55) COLORWHITE;

MA89:MA(C,89)COLORYELLOW ;

MA144:MA(C,144) COLORRED LINETHICK2;

CCL:=ABS((2*CLOSE+HIGH+LOW)/4-MA(CLOSE,20))/MA(CLOSE,20);

DDL:=DMA(CLOSE,CCL);

上:=(1+7/100)*DDL,DOTLINE,COLORGREEN;

下:=(1-7/100)*DDL,DOTLINE,COLORGREEN;

中:=(上+下)/2,DOTLINE,COLORGREEN;

上上:=EMA(上,181),DOTLINE,COLORRED;

下下:=EMA(下,181),DOTLINE,COLORRED;

中中:=EMA(中,181),DOTLINE,COLORRED;

DRAWICON(上>=上上,上上,17);

主十增仓:10*WINNER(CLOSE*0.9)*8,NODRAW COLORYELLOW;

十换手:SUM(VOL/CAPITAL*100,10),NODRAW COLORWHITE;

ER:=V/FINANCE(7)*100;

MAXCYC:=DMA((C+O)/2,ER/TMA(ER,(1-ER),1));

T1T:=BARSLAST(C>MAXCYC*POW(1.1,0.9));

T2T:=BARSLAST(C<maxcyc*pow(1.1,-0.9)); p=""> </maxcyc*pow(1.1,-0.9));>

T3T:=CROSS(T1T,T2T) OR CROSS(T2T,T1T) OR BARSSINCE(T1T+1)=0 OR BARSSINCE(T2T+1)=0 OR BARSCOUNT(C)=0;

T4T:=REF(MAXCYC,BARSLAST(T3T));

主力盈利:LN(C/T4T)/LN(1.1)*10,NODRAW;

{盈利天:BARSLASTCOUNT(主力盈利>0) COLORMAGENTA,NODRAW;}

获利比例:WINNER(CLOSE)*100,NODRAW;

DRAWICON(获利比例>0 AND 获利比例<=2,L*0.98,9);

DRAWICON(获利比例>2 AND 获利比例<=5,L*0.98,23);

P1:=90;

AO:=P1+(100-P1)/2;

BO:=(100-P1)/2;

CCO:=COST(AO);

DDO:=COST(BO);

筹码集中度:(CCO-DDO)/(CCO+DDO)*100/2,COLORRED,NODRAW;

DRAWICON(获利比例>80 AND 筹码集中度<10,L*0.98,25);

翻倍:=REFDATE(REF(LLV(LOW,90),3),DATE)=LOW AND (CLOSE-LOW>0-CLOSE OR OPEN-LOW>CLOSE-OPEN);

STICKLINE(翻倍,H,H*1.2,2,0),COLORLIRED;

DRAWTEXT(翻倍,H*1.2,'机会来了'),COLORYELLOW;

DRAWTEXT(翻倍,H*1.15,'坚决持有'),COLORCYAN;

DRAWTEXT(翻倍,H*1.1,'后市暴涨'),COLORMAGENTA;

N:=1.5;

M:=3;

DIFF:=EMA((EMA(CLOSE,N*12)-EMA(CLOSE,N*26))/EMA(CLOSE,N*26)*1000,M);

DEAF:=EMA(DIFF,N*9),COLOR000088;

加仓:IF(DIFF>=REF(DIFF,1) AND DEAF<ref(deaf,1),diff,drawnull),colorlired,nodraw; p=""> </ref(deaf,1),diff,drawnull),colorlired,nodraw;>

短线出局:=IF(DIFF REF(DEAF,1),DIFF,DRAWNULL),NODRAW;

STICKLINE(加仓 ,C,C*1.0015,8,0),COLORYELLOW;

在告诉你答案之前,先简短的讲讲我的经历吧!十多年前,我是世界500强企业的一名职员。通过自学,考试后现在转行为证券公司的一名投顾。在我转行之前也是到处找资料学习。相关的书籍啊,指标啊等等,但掌握了一些基础知识后发现即使学会了这些东西还是远远不能在这个市场上生存的。通过认真思考我发现,如果做投资没有自己的交易体系,那是很危险的一件事。在自己的交易体系建立之前,我做过外汇,做过权证,做过商品期货,做过期权,当然也有股票。现在从业了,所以也就只是做做股票的模拟盘。所以对于指标类的东西还是有所发言权的。言归正传,下面来回答一下你的问题吧!

1.如果你真的想在这个投资市场上畅意的行走,你首先应该建立自己的交易体系。

2.在你建立交易体系之后,我现在正式回答你的问题。正常情况下,你只需要认真研究系统默认的几个指标就可以了,K线,均线,量,KDJ,MACD就这几个,其它杂乱的指标都是通过这几个基础指标编辑演变而成的,因为是手机截图,所以这里截了两个图,如果需要操盘,建议最好是用电脑。

3.K线,K线就是红绿柱,他代表最高价,最低价,开盘价和收盘价。在这里我就不详细赘述了。

4.均线,均线分日,月,周,季,年均线等。那要看你是什么周期,比如日均线m5就是五天内的平均价,也就是五日均线。M10就是十天均线等等。

5.量,量就比较复杂一点,常常需要配合其他指标使用,它代表成交量或成交额。周期也是和均线一样。

6.MACD和KDJ,同样需要结合周期来使用,最常见的就是金叉和死叉,但是也需要结合市场环境来看。


给大家一个去掉不适合自己参与的过滤选股器吧,懂代码的可以自己修改,不懂得那就直接用,有几个参数最好自己做一下修改,比如,股价,交易密度,等等。

它的功能是选出适合自己的带有涨停板的活跃股,他不是操作的依据,只是帮你过滤掉那些不适合参与的股票,每天盘后下载数据,复盘选股,他不适合最预警,只适合复盘高效选股。

仅供参考(通达信使用者)

公式名称:去掉无效选股

参数:N=2:2000:60(周期数)

N1=1:200:3(涨停板个数)

SS=2:2000:50(股价)

NN=2:30:15(交易密度)


ENTERLONG:=CROSS(MA(CLOSE,5),MA(CLOSE,20));{这是一个均线自动交易代码暂时先保存着以备后用}

EXITLONG:=CROSS(MA(CLOSE,5),MA(CLOSE,3));{这是一个均线自动交易代码暂时先保存着以备后用}

ZTTJ1:=(CLOSE>=ZTPRICE(REF(CLOSE,1),0.1));

ZTTJ:=(CLOSE>=ZTPRICE(REF(CLOSE,1),IF(FINANCE(3)=3,0.2,0.1)));

ZTTM:=COUNT(ZTTJ,N)>=N1;

AR2:=EVERY(ZTTJ,2);

AR3:=COUNT(AR2,60)>=1;

RZ1:=INBLOCK('壳资源')=0; RZ2:=INBLOCK('商誉减值')=0; RZ4:=INBLOCK('风险品种')=0;

RZ6:=INBLOCK('细分龙头')=1; RZ7:=INBLOCK('已高送转')=0;

{通达信去掉创业板*ST} S1:=IF(CODELIKE(馄'),1,0);

{通达信去掉退市股}{去掉不需要的板块}{通达信去掉*、S、ST}

S2:=IF(NAMELIKE('S'),0,1); S3:=IF(NAMELIKE('*'),0,1);

{通达信去掉停牌}

S4:=DYNAINFO(17)>0;

S5:= BETWEEN(FINANCE(7)/10000000,1,400) AND FINANCE(7)*C/100000000<360 AND C<ss p="" ;

{去掉融券融资 AND S6}

S6:=FINANCE(52)=0;

S7:=IF(CODELIKE(鬈'),0,1);{通达信去掉科创板}

S10:=FINANCE(30)>=-5;

S12:=DYNAINFO(39)<500;

S13:=SUM(DYNAINFO(37),20)>0.2;

S14:=FINANCE(30)/FINANCE(20)*100>-50;

ST:S2 AND S3 AND S4 AND S7 AND RZ4 AND S13 AND ZTTM AND C<ss;{and p="" s1}

AA1:=C/REF(C,1)>1.03 AND C<ss p="" s7;{强势选股}

AB1:=FROMOPEN*NN;

AB2:=DYNAINFO(50)>AB1;

S11:=IF(AB2,AA1,DRAWNULL);

大家好,给大家分享一个监测庄家动向的指标——猎庄擒牛。指标通过对庄家资金的监测,可以捕捉到庄家何时进场拉升,何时出货离场。洞察到庄家的这些动向之后,散户猎庄擒牛并不只是说说而已。

“猎庄擒牛”指标要点:

一、指标提示“庄家出现”信号时,表明监测到此处有庄家大资金进场,行情即将开启拉升,可跟进建仓。

二、指标提示“庄家出货”信号时,表明监测到此处庄家在进行筹码派发,应果断止盈离场,落袋为安。

效果图:

“猎庄擒牛”主要作用就是对庄家大资金动向的监测,从而给出预警信号。当然指标还有其它关于筹码和趋势的信号判断,这里就不做过多讲解,大家拿到后可以去慢慢摸索。

大道至简,简单有效不要复杂。股市中最有效的技术指标就是那些最贴近市场本质的数据跟踪指标,我最常用的就是K线,均线,MACD和量能及均量线,够用了。

在一个多变复杂的市场中,越简单反而才是越有效,过于复杂的技术工具适应能力太差。

通达信精准指标——趋势布林线主图+神针起爆副图+源码 给大家分享一个趋势布林线主图,搭配神针起爆副图,适用于短线和中长线,是基于系统布林线而研发的,比系统自带的更加精准。 主图当出现红色箭头为建仓信号,当出现绿色箭头为减仓或者平仓信号。 副图红色趋势为上升趋势,绿色趋势为下跌趋势,红色趋势变为绿色交叉点为减仓信号。 绿色趋势变为红色为建仓信号,出现神针起爆红柱可作为启动点和建仓点。

主副图点位一一对应,产生共振。 源码

这套指标主要利用主副图共振点来进行操作,精准率很高,喜欢的朋友可以关注我的首页,留言指标二字,我会免费分享给大家。

好用的公式有很多,但是适合自己才行!今天我分享几个我自己经常用的公式分享给大家!

擒牛大中短


这个公式主要就是抓买卖点的指标,不含未来函数,可以放心操作!

主力波段吸筹

该公式是精准判断操作位置,依然没有未来函数!

其次,如果大家想炒股,先学习一些基本的炒股知识,并且少量投入,切不可一梭哈。不要迷信技术指标,所谓的指标都是事后才出来的,有精力的可以去看看指标编程,无非都出自于成交量、成交额、均线等等,所以都是滞后的。简单的K线、成交量、2条均线,辅助参考判断即可。技术指标越复杂,越难以付诸实施。

所以,还请大家不要迷恋技术指标,我曾经花了1年多的时间研究、编写各种技术指标,到现在,我已经放弃了,只留了交易软件里面最原始的指标,做辅助判断而已,记住只是辅助判断。还请大家不要走弯路,一入股市深似海,到处都是坑,切记!!!

这个我认为因人而异,毕竟适合自己的指标才是好指标。这里我们来分享下我常用的指标

第一,均线,均线是时候非常实用的指标,无论是短线,中线,长线都非常实用。

(1)如果是短线,5日均线就够了。5日均线比较神奇。

①当K线从5日均线下方上穿5日均线,而且均线开始拐头,结合量能,底部放量,那么短线就可以把我了,而且是超短机会。基本都有不错的收益。

②当市场均线多头排列,只要K线在5日均线上方,沿着5日均线上行,那么也是一个持仓的机会。

(2)中线,中线一般就是看20日均线,这个均线比较实用,也称为万能均线,只要K线站稳在20日均线上方,而且拐头向上,结合筹码,筹码低位单峰,中线就可以把握。

(3)长线,长线就是60日均线上穿120日均线,而且趋势上行。

第二,MACD,领略到精髓,赚钱非常简单。

1、 MACD在0轴上方——每发生一次金叉,股价将创新高,但是二次金叉不要追。2、 MACD在0轴下方——每发生一次死叉,股价将创新低新低后可以适当的补仓。3, MACD在0轴上方——金叉死叉次数越多越好、牛股,4,, MACD在0轴下方——金叉死叉次数越多越差、熊股。5,MACD水下两次金叉,第二次金叉就是买入机会。6.MACD的黄白两线不能和柱状形成背离,背离则会产生行情反转。

好了我就分享了我常用的这两个希望对大家有帮助。


如果想听实话,我就告诉你。最好用的指标是:K线、成交量(手)、均线和MACD。其它指标都可以忽略。

你进入丛林,容易绕花眼睛,七选八选-选个漏眼。其实最显眼的就是最好的。

⑤ 请教一下,三菱PLC的通讯指令ADPRW S S1 S2 S3 S4/D各代表什么。

ADPRW代表指令的使用

S代表从站的站号,例如要与1号站通信,S的位置就填写H1。

S1是MODBUS的命令代码。

S2是MODBUS软元件的地址。

S3是设置从S2设置的MODBUS软元件地址开始的几个地址。S1如果使用写的命令代码,就代表从S2地址开始写入S3个地址;S1如果使用读的命令代码,就代表从S2地址开始读取S3个地址。

S4/D:S1如果使用写的命令代码,标记S4,表示把S4设置的软元件的数据写给从站;如果使用读的命令代码,标记D,表示把从站的数据读到D设置的软元件中。

(5)ids4源码扩展阅读:

三菱公司PLC网络继承了传统使用的MELSEC网络,并使其在性能、功能、使用简便等方面更胜一筹。Q系列PLC提供层次清晰的三层网络,针对各种用途提供最合适的网络产品.

1、信息层银锋亏/Ethernet(以太网) 信息层为网络系统中最高层,主要是在PLC、设备控制器以及生产管理用PC之间传输生产管理信息、质量管理信息及设备的运转情况等数据,信息层使用最普遍的Ethernet。

它不仅能够连接windows系统的PC、UNIX系统的工作站等,而且还能连接各种FA设备。Q系列PLC系列的Ethernet模块具有了日益普及的因特网电子邮件收发功能,使用户无论在世界的任何地方都可以方便地收发生产信息邮件,构筑远程监视管理系统。

同时,利用因特网的FTP服务器功能及MELSEC专用协议可以很容易的实现程序的上传/下载和信息的传输。

2、控制层/MELSECNET/10(H) 是整个网络系统的中间层,在是PLC、CNC等控制设备之间方便且高速地进行处理数据互传的控制网络。

作为MELSEC控制网络的MELSECNET/10,以它良好的实时性、简单的网络设定、无程序的网络数据共享概念,以及冗余回路等特点获得了很高的市场评价,被采用的设备台数在日本达到最高,在世界上也是屈指可数的。

而MELSECNET/H不仅继承了MELSECNET/10优秀的特点,还使网络的实时性更好,数据容基咐量更大,进一步适应市场的需要。

3、设备层/现场总线CC-Link 设备层是把PLC等控制设备和传感器以及驱动设备连接起来的现场网络,为整个网络系统最低层的网络。采用CC-Link现场总线连接,布线数量大大减少,提高了系统可维护性。

而且,不只是ON/OFF等开关量锋神的数据,还可连接ID系统、条形码阅读器、变频器、人机界面等智能化设备,从完成各种数据的通信,到终端生产信息的管理均可实现,加上对机器动作状态的集中管理,使维修保养的工作效率也大有提高。在Q系列PLC中使用,CC-Link的功能更好,而且使用更简便。

阅读全文

与ids4源码相关的资料

热点内容
udp命令字 浏览:659
app服务端java源码 浏览:798
电脑用文件夹玩大型游戏 浏览:254
安卓耳塞失灵怎么办 浏览:765
华三交换机保存命令 浏览:605
命令方块怎么调键盘 浏览:841
不把密码存在服务器上怎么办 浏览:398
怎么让指令方块的命令消失 浏览:543
用单片机做plc 浏览:404
云服务器进入子目录命令 浏览:795
服务器机柜如何配电 浏览:578
怎么删除iphone资源库里的app 浏览:940
pdf鱼 浏览:648
单片机pcf8591什么作用 浏览:805
sql命令学院 浏览:283
加密软件在电脑那个盘 浏览:988
android获取外部存储 浏览:573
怎么查自己家的服务器地址 浏览:858
编程c语言工作好不好 浏览:569
单片机焊接地怎么连接 浏览:694