① linux学习书籍求推荐
Linux学习书籍求推荐
1、《Linux与Unix Shell 编程指南》
C语言基础
1、《C Primer Plus,5th Edition》【美】Stephen Prata着
2、《The C Programming Language, 2nd Edition》【美】Brian W. Kernighan David M. Rithie(K & R)着
3、《Advanced Programming in the UNIX Environment,2nd Edition》(APUE)
4、《嵌入式Linux应用程序开发详解》
Linux内核
1、《深入理解Linux内核》(第三版)
2、《Linux内核源代码情景分析》毛德操 胡希明着
研发方向
1、《UNIX Network Programming》(UNP)
2、《TCP/IP详解》
3、《Linux内核编程》
4、《Linux设备驱动开发》(LDD)
硬件基础
1、《ARM体系结构与编程》杜春雷着
2、S3C2410 Datasheet
英语基础
1、《计算机与通信专业英语》
系统教程
1、《嵌入式系统――体系结构、编程与设计》
2、《嵌入式系统――采用公开源代码和StrongARM/Xscale处理器》毛德操 胡希明着
3、《Building Embedded Linux Systems》
理论基础
1、《算法导论》
2、《数据结构(C语言版)》
3、《计算机组织与体系结构?性能分析》
4、《深入理解计算机系统》【美】Randal E. Bryant David O’Hallaron着
5、《操作系统:精髓与设计原理》
6、《编译原理》
7、《数据通信与计算机网络》
8、《数据压缩原理与应用》
入门篇
《LINUX权威指南》书不错,写的很全面也比较广,涉及的不深,做为入门书籍不错,可以比较全面的了解linux 。另外比较热门的也可以看看《鸟哥的私房菜》等书,偏管理类的书。如果想做server方向的可以找来看看。
驱动 篇
《LINUX设备驱动程序 》就是网上说的“LDD”,经典之作,必备书籍。国产经典《Linux驱动详细解》也是一本非常不错的书,很实用,书中源代码分析比较多,基于2440的,对linux外围驱动有很全面的讲解
内核篇
浙江大学的《LINUX内核源代码情景分析》,外国鬼子的《莱昂氏UNIX源代码分析》还有《深入理解linux内核》都是出名的经典巨作。另外赵 炯的《LINUX内核完全剖析–基于0.12内核》也非常不错,对内核代码进行了详细的注释,非常有助于对内核的理解和代码的分析。
shell篇
《LINUX与UNIX Shell编程指南》
应用 编程
不用说了肯定是《unix环境高级编程》被称为unix编程的圣经。
TCP/IP篇
《TCP/IP详解》作者W.Richard Stevens也是《unix环境高级编程》的作者,牛人出的书没有一本不是经典的。但是英年早逝,默哀一下。
c语言
《The C Programming Language》正是作者造出来的c语言,书能垃圾就怪了
《c和指针》和《c缺陷和陷阱》两本必备。包含了c语言最容易出错的地方,加深c语言功力的好材料。
关于算法
《算法导论》
1 熟悉linux基本环境 >>> 《鸟哥的私访菜》《unix初级教程》 《linux编程宝典》(市面上无,图书馆有), 等等。
2 熟悉操作系统的基础知识 >>> 《现代操作系统》 《操作系统概念》
3 熟悉系统编程 >>> 《unix环境高级编程第二版》《unix操作系统设计与实现》
4 内核 按先后顺序: 《 linux内核设计与实现》 《linux设备驱动程序》 《深入理解 linux内核》 《linux内核源代码情景分析》 《深入理解linux虚拟内存系统》
5 其他一些书籍: 《freebsd操作系统设计与实现》 《solaris内核结构》 《unix高级教程:系统技术内幕》 《现代体系结构的unix系统:内核程序员的smp与cache技术》 《保护方式下的80386及其编程》 (后3本市面上没了,大学图书馆里一般都有》 《Intel64 and IA-32 Arichitectures Software Developer’s Manual》
6 其实内核玩深了,体系和编译也要学好 《计算机体系结构:量化研究方法》 《编译原理》(龙书)
Linux编程推荐书籍一览表
shell 编程
《LINUX与UNIX SHELL编程指南》
BASH宝典:
Advanced Bash Scripting Guide (如果你使用的是 GNU/Debian 系统,可以用 apt-get install abs-guide 安装该文档)
BASH Programming – Introction HOW-TO
Bash Man
用户级编程书籍:
Advanced Programming in the UNIX Environment(中文版《UNIX环境高级编程》第二版) 作者 W.Richard
Stevens/尤晋元等
GNU/Linux编程指南 作者 Kurt Wall
Linux 程序设计权威指南 作者 于明俭、陈向阳、方汉
《The Art of Unix Programming》作者 E.S.R
Computer Systems A Programmer’s Perspective
(中文名)《深入理解计算机系统(修订版)》
《Unix Systems Programming》(中文版《UNIX系统编程》)作者: (美)KAY
A.ROBBINS, STEVE ROBBINS 译者:陈涓 赵振平
网络编程:
Unix Network Programming V1 & V2,Unix网络编程卷1、2 作者 W.Richard Stevens
《unix网络编程》
XWindow编程
Definitive Guides to the X WindowSystem 作者 Dan Heller, Paula M. Ferguson
内核源代码阅读(结合源代码)和编程
(入门)
《边干边学Linux内核指导》
(高级)
《Linux Kernel Development》
《Linux内核源代码情景分析》
《深入分析Linux内核源代码》 陈莉君
《 Understanding Linux Network Internals 》即《 深入理解Linux网络内幕(英文影印版)》Christian Benvenuti
内核模块编程
《The Linux Kernel Mole Programming Guide》
Linux设备驱动编程
Linux设备驱动程序/Linux Device
Drivers 作者 Alessandro Ruibini
多线程编程
《多线程编程指南》
② 知道源代码有什么好处要源代码用了干什么
源代码(也称源程序)是指未编译的按照一定的程序设计语言规范书写的文本文件,是一系列人类可读的计算机语言指令。?在郑橘现代程序语言中,源代码可以是以书籍或者磁带的形式出现,但最为常用的格式是文本文件,这种典型格式的目的是为了编译出计算机程序。计算机源代码的最终目的是将人类可读的文本翻译成为计算喊枣团机可以执行的二进制指令,这种过程叫做编译,通过编译器完成。
通常我们从开发方得到的程序,已是可执行文件,即通过编译的程序。那么拿到源代码有什么好处呢?
可以在源代码的岩慎基础上进行二次开发,完善或丰富现有系统功能。
参考学习。通过分析源代码,可以学习开发、了解开发者的思路,学习开发者如何通过巧妙的方式、算法解决业务问题,阅读源代码是提高开发水平的快捷方式。
拥有源代码,可以占据主动权。如果开发方在后期对运维或增加功能方面,报价远超市场价,委托方有源代码的话,可以考虑更换开发方,而不会因此造成整套软件重写。
委托方拿到源代码,是拥有知识产权的首要条件。
当然现在软件市场上,很多软件开发公司或开发人员并不愿意将源代码提供给委托方。
因此如果委托方确定需要拥有源代码的话,在项目开始前,就应该跟被委托方声明:验收时,需提供源代码,否则一般情况下,都不会提供源代码。
③ 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
④ 游戏源代码有什么用
问题一:源代码在游戏中的作用 网络游戏源代码就是游戏的基础,在外行人眼里是无数行的英文和数字,其实就是一组程序。
作用当然是开发游戏啦。
手上拥有了源代码就可以制作游戏,当然如果你啥都不改,那功能就和原来的游戏没什么两样。
现在网上你可以搜索一下网络游戏的源代码还是非常多的,但是大多数都是不完整的,也就是说你即便得到了也无法用。
另外只要这款游戏是国产的,你如果一模一样也不行,因为违反版权。
所以就算你拿到了源代码,你也要有完整的美术资源,需要让程序贴图替换上去,达到视觉上不一样的效果。世界背景和故事都要换,所有这些的成本当然不是一般的高。
好吧,即便你搞好了,那接下来你还要运营吧,运营的成本就更高了。
问题二:游戏代码到底有什么用,详细一点 5分 游戏代码吗?代码并不是什么很神秘的东西,你把编程语言的链岁基础学好了,什么都会知道的了。
问题三:源代码怎么用的啊??有的游戏给 有的程序个给的那个 不知道你玩的啥游戏,但是看样子估计是c++代码,我英文学的不好
从英文描述中我猜测这是v c++的代码,“”在代码中表示注释,前三行是注释,其大意如下:
stdafx.cpp :源文件,包括刚才的标准单元?
fixyou.pch将是预编译的标题
stdafx.obj将包含预编译的类型信息
“cpp”明显是c++源码文件的缩写名,而最后一行是头文件。
所谓头文件预编译,就是把一个工程(Project)中使用的一些MFC标准头文件(如Windows.H、Afxwin.H)预先编译,以后该工程编译时,不再编译这部分头文件,仅仅使用预编译的结果。这样可以加快编译速度,节省时间。
预编译头文件通过编译stdafx.cpp生成,以工程名命名,由于预编译的头文件的后缀是“pch”掘雹,所以编译结果文件是projectname.pch。
编译器通过一个头文件stdafx.h来使用预编译头文件。stdafx.h这个头文件名是可以在project的编译设置里指定的。编译器认为,所有在指令#include stdafx.h前的代码都是预编译的,它跳过#include stdafx. h指令,使用projectname.pch编译这条指令之后的所有代码。
因此,所有的CPP实现文件第一条语句都是:#include stdafx.h。
其实我学的pascal,所以对c++了解的少,如果你真的想学会他,还是自己找几本c++的书学一下,这样才能“使用”代码得心应手。
问题四:游戏源代码怎么使用 楼上请不要那样你难道没有初学的时候吗判唤帆??这是一个欲编译头文件 按例说只是源代码的非常小的一部分你可以用Visual Studio 2005打开
问题五:手机游戏源代码是什么,怎么使用 不知道你玩的啥游戏,但是看样子估计是c++代码,我英文学的不好
从英文描述中我猜测这是v c++的代码,“”在代码中表示注释,前三行是注释,其大意如下:
stdafx.cpp :源文件,包括刚才的标准单元?
fixyou.pch将是预编译的标题
stdafx.obj将包含预编译的类型信息
“cpp”明显是c++源码文件的缩写名,而最后一行是头文件。
所谓头文件预编译,就是把一个工程(Project)中使用的一些MFC标准头文件(如Windows.H、Afxwin.H)预先编译,以后该工程编译时,不再编译这部分头文件,仅仅使用预编译的结果。这样快编译速度,节省时间。
预编译头文件通过编译stdafx.cpp生成,以工程名命名,由于预编译的头文件的后缀是“pch”,所以编译结果文件是projectname.pch。
编译器通过一个头文件stdafx.h来使用预编译头文件。stdafx.h这个头文件名是可以在project的编译设置里指定的。编译器认为,所有在指令#include stdafx.h前的代码都是预编译的,它跳过#include stdafx. h指令,使用projectname.pch编译这条指令之后的所有代码。
因此,所有的CPP实现文件第一条语句都是:#include stdafx.h。
其实我学的pascal,所以对c++了解的少,如果你真的想学会他,还是自己找几本c++的书学一下,这样才能“使用”代码得心应手。
问题六:游戏源码一般都是用什么语言写的? 编写单机 PC/主机游戏现在都是 C++ 加上一个脚本语言(比如 Lua,这地方不需要脚本引擎多么高性能,够用就好)。游戏的架构是引擎 + 游戏逻辑,两者代码量是引擎远远大于游戏逻辑。商业游戏往往引擎是重用多于自研,所以那些大型游戏的代码也不是全部都是一行一行敲出来的――很可能其中许多内容是买来的。
网游服务端则一般是自研,这个真是一行一行敲了。网游 EVE 的服务器完全是照着超算的标准修的,算法也完全是超算的算法。编写单机 PC/主机游戏现在都是 C++ 加上一个脚本语言(比如 Lua,这地方不需要脚本引擎多么高性能,够用就好)。游戏的架构是引擎 + 游戏逻辑,两者代码量是引擎远远大于游戏逻辑。商业游戏往往引擎是重用多于自研,所以那些大型游戏的代码也不是全部都是一行一行敲出来的――很可能其中许多内容是买来的。
问题七:我有C++一个游戏的源代码,但是要怎么运行?
问题八:c语言编写的小游戏源代码在什么环境下可以运行 如果源代码埂有.C(或者.cpp)和.h类型的文件,你可以尝试用TC或者BC打开后编译运行;
如果源代码还包括.dsw或者.dsp类型的文件,你可以试试用VC6或VC++.NET打开后编译运行。
问题九:C++做一个小游戏,有源代码的最好,谢谢 #include
#include
#include
#include
#include
#include 时间 文件
#include
#define random(x)(rand()%x)
using namespace std;
void thunder(int Dif,int Row,int Column,char *USer)
{
int r,c,alls[22][22],backstage[22][22]={0};
srand((int)time(0));
for(r=1;r(*||数字) 的个数 赢的时候停止循环)
for(c=1;c>
问题十:源代码在游戏中的作用 网络游戏源代码就是游戏的基础,在外行人眼里是无数行的英文和数字,其实就是一组程序。
作用当然是开发游戏啦。
手上拥有了源代码就可以制作游戏,当然如果你啥都不改,那功能就和原来的游戏没什么两样。
现在网上你可以搜索一下网络游戏的源代码还是非常多的,但是大多数都是不完整的,也就是说你即便得到了也无法用。
另外只要这款游戏是国产的,你如果一模一样也不行,因为违反版权。
所以就算你拿到了源代码,你也要有完整的美术资源,需要让程序贴图替换上去,达到视觉上不一样的效果。世界背景和故事都要换,所有这些的成本当然不是一般的高。
好吧,即便你搞好了,那接下来你还要运营吧,运营的成本就更高了。
⑤ 求RSA算法的源代码(c语言)
这个是我帮个朋友写的,写的时候发现其实这个没那么复杂,不过,时间复杂度要高于那些成型了的,为人所熟知的rsa算法的其他语言实现.
#include
int
candp(int
a,int
b,int
c)
{
int
r=1;
b=b+1;
while(b!=1)
{
r=r*a;
r=r%c;
b--;
}
printf("%d",r);
return
r;
}
void
main()
{
int
p,q,e,d,m,n,t,c,r;
char
s;
{printf("input
the
p:\n");
scanf("%d\n",&p);
printf("input
the
q:\n");
scanf("%d%d\n",&p);
n=p*q;
printf("so,the
n
is
%3d\n",n);
t=(p-1)*(q-1);
printf("so,the
t
is
%3d\n",t);
printf("please
intput
the
e:\n");
scanf("%d",&e);
if(e<1||e>t)
{printf("e
is
error,please
input
again;");
scanf("%d",&e);}
d=1;
while
(((e*d)%t)!=1)
d++;
printf("then
caculate
out
that
the
d
is
%5d",d);
printf("if
you
want
to
konw
the
cipher
please
input
1;\n
if
you
want
to
konw
the
plain
please
input
2;\n");
scanf("%d",&r);
if(r==1)
{
printf("input
the
m
:"
);/*输入要加密的明文数字*/
scanf("%d\n",&m);
c=candp(m,e,n);
printf("so
,the
cipher
is
%4d",c);}
if(r==2)
{
printf("input
the
c
:"
);/*输入要解密的密文数字*/
scanf("%d\n",&c);
m=candp(c,d,n);
printf("so
,the
cipher
is
%4d\n",m);
printf("do
you
want
to
use
this
programe:yes
or
no");
scanf("%s",&s);
}while(s=='y');
}
}
⑥ 求一个单链表归并排序算法,C语言的源代码,急需!
//MergeSort.cpp
#include <iostream.h>
#include <conio.h>
#define MAXSIZE 20
#define LENGTH 7
typedef int RedType;
typedef struct //SqList structure
{ RedType r[MAXSIZE+1]; //Records Type
int length;
}SqList;
typedef SqList RcdType;
void Merge(RcdType SR,RcdType &TR,int i,int m,int n) //Merge() function
{ int j,k;
for(j=m+1,k=i;i<=m&&j<=n;++k)
{ if(SR.r[i]<=SR.r[j])
TR.r[k]=SR.r[i++];
else
TR.r[k]=SR.r[j++];
}
while(i<=m)
TR.r[k++]=SR.r[i++];
while(j<=n)
TR.r[k++]=SR.r[j++];
}//end of Merge() function
void MSort(RcdType SR,RcdType &TR1,int s, int t) //MSort() function
{ int m;
RcdType TR2;//[LENGTH];
if(s==t)
TR1.r[s]=SR.r[t];
else
{ m=(s+t)/2;
MSort(SR,TR2,s,m);
MSort(SR,TR2,m+1,t);
Merge(TR2,TR1,s,m,t);
}//end of else
}//end of MSort() function
void MergeSort(SqList &L) //MergeSort() function
{
MSort(L,L,1,L.length);
}//end of MergeSort() function
void main() //main function
{ int i;
SqList L;//={{0,49,38,65,97,76,13,27,},LENGTH};
cout<<"MergeSort.cpp"<<endl<<"============="<<endl<<endl;
cout<<"Please input the length of SqList L: <eg. 7> ";
cin>>L.length;
cout<<"Please input the disordered array L.r: <eg. {49,38,65,97,76,13,27,...}>"<<endl;
for(i=1;i<=L.length;i++)
cin>>L.r[i];
MergeSort(L);
cout<<endl<<"The sorted array L.r: ";
for(i=1;i<=L.length;i++)
cout<<L.r[i]<<" ";
cout<<endl;
cout<<"...OK!..."<<endl;
getch();
}//end of main() function我以前的,可以调试的
应该符合你要求,只是很少部分你自己改一下,比如数的个数
输入改为 rand()随即输入,刚才粘贴错了
⑦ 知道源代码有什么好处要源代码用了干什么
一、源代码用途:
生成目标代码,即计算机可以识别的代码。
对软件进行说明,即对软件的编写进行说明。为数不少的初学者,甚至少数有经验的程序员都忽视软件说明的编写,因为这部分虽然不会在生成的程序中直接显示,也不参与编译。但是说明对软件的学习、分享、维护和软件复用都有巨大的好处。因此,书写软件说明在业界被认为是能创造优秀程序的良好习惯,一些公司也硬性规定必须书写。
需要指出的是,源代码的修改不能改变已经生成的目标代码。如果需要目标代码做出相应的修改,必须重新编译。
二、源代码好处:
1、它们能降低企业部署网络和各种服务的成本,如果采用开源方案,你只需要一台服务器,其他的都可以免费,而用windows,你必须花钱购买操作系统(假设没有盗版)。
2、可以在源代码的基础上进行二次开发,完善或丰富现有系统功能。
3、参考学习。通过分析源代码,可以学习开发、了解开发者的思路,学习开发者如何通过巧妙的方式、算法解决业务问题,阅读源代码是提高开发水平的快捷方式。
4、拥有源代码,可以占据主动权。如果开发方在后期对运维或增加功能方面,报价远超市场价,委托方有源代码的话,可以考虑更换开发方,而不会因此造成整套软件重写。