導航:首頁 > 源碼編譯 > 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源碼相關的資料

熱點內容
命令方塊怎麼調鍵盤 瀏覽:841
不把密碼存在伺服器上怎麼辦 瀏覽:398
怎麼讓指令方塊的命令消失 瀏覽:543
用單片機做plc 瀏覽:404
雲伺服器進入子目錄命令 瀏覽:795
伺服器機櫃如何配電 瀏覽:578
怎麼刪除iphone資源庫里的app 瀏覽:940
pdf魚 瀏覽:648
單片機pcf8591什麼作用 瀏覽:805
sql命令學院 瀏覽:283
加密軟體在電腦那個盤 瀏覽:988
android獲取外部存儲 瀏覽:573
怎麼查自己家的伺服器地址 瀏覽:858
編程c語言工作好不好 瀏覽:569
單片機焊接地怎麼連接 瀏覽:694
游戲源碼怎麼抓 瀏覽:216
程序員幫大家引走怪物 瀏覽:16
手機網頁小游戲源碼 瀏覽:513
戰地一伺服器怎麼設置管理員 瀏覽:396
數控車床編程可以上班嗎 瀏覽:460