对称加密算法之DES介绍
DES(Data Encryption Standard)是分组对称密码算法。DES采用了64位的分组长度和56位的密钥长度,它将64位的输入经过一系列变换得到64位的输出。解密则使用了相同的步骤和相同的密钥。DES的密钥长度为64位,由于第n*8(n=1,2,…8)是校验位,因此实际参与加密的长度为56位,密钥空间含有2^56个密钥。
DES算法利用多次组合替代算法和换位算法,分散和错乱的相互作用,把明文编制成密码强度很高的密文,它的加密和解密用的是同一算法。
DES算法,是一种乘积密码,其在算法结构上主要采用了置换、代替、模二相加等函数,通过轮函数迭代的方式来进行计算和工作。
DES算法也会使用到数据置换技术,主要有初始置换IP和逆初始置换IP^-1两种类型。DES算法使用置换运算的目的是将原始明文的所有格式及所有数据全部打乱重排。而在轮加密函数中,即将数据全部打乱重排,同时在数据格式方面,将原有的32位数据格式,扩展成为48位数据格式,目的是为了满足S盒组对数据长度和数据格式规范的要求。
一组数据信息经过一系列的非线性变换以后,很难从中推导出其计算的过程和使用的非线性组合;但是如果这组数据信息使用的是线性变换,计算就容易的多。在DES算法中,属于非线性变换的计算过程只有S盒,其余的数据计算和变换都是属于线性变换,所以DES算法安全的关键在于S盒的安全强度。此外,S盒和置换IP相互配合,形成了很强的抗差分攻击和抗线性攻击能力,其中抗差分攻击能力更强一些。
DES算法是一种分组加密机制,将明文分成N个组,然后对各个组进行加密,形成各自的密文,最后把所有的分组密文进行合并,形成最终的密文。
DES加密是对每个分组进行加密,所以输入的参数为分组明文和密钥,明文分组需要置换和迭代,密钥也需要置换和循环移位。在初始置换IP中,根据一张8*8的置换表,将64位的明文打乱、打杂,从而提高加密的强度;再经过16次的迭代运算,在这些迭代运算中,要运用到子密钥;每组形成的初始密文,再次经过初始逆置换IP^-1,它是初始置换的逆运算,最后得到分组的最终密文。
图1 DES流程图
图1左半部分,DES对明文的处理经过了三个阶段。首先,64位的明文经过初始置换(IP)而被重新排列。而后进行16轮的相同函数的作用,每轮的作用都有置换和代换。最后一轮迭代的输出有64位,它是输入明文和密钥的函数。将其左半部分和右半部分互换产生预输出。最后,预输出再与初始置换(IP)互逆的逆初始置换(IP^-1)作用产生64位的密文。
图2右半部分,给出了作用56比特密钥的过程。DES算法的加密密钥是64比特,但是由于密钥的第n*8(n=1,2…8)是校验(保证含有奇数个1),因此实际参与加密的的密钥只有56比特。开始时,密钥经过一个置换,然后经过循环左移和另一个置换分别得到子密钥ki,供每一轮的迭代加密使用。每轮的置换函数都一样,但是由于密钥位的重复迭代使得子密钥互不相同。
DES算法利用多次组合替代算法和换位算法,分散和错乱的相互作用,把明文编制成密码强度很高的密文,它的加密和解密用的是同一算法。
DES算法详述:DES对64位明文分组(密钥56bit)进行操作。
1. 初始置换函数IP:64位明文分组x经过一个初始置换函数IP,产生64位的输出x0,再将分组x0分成左半部分L0和右半部分R0:即将输入的第58位换到第一位,第50位换到第2位,…,依次类推,最后一位是原来的第7位。L0、R0则是换位输出后的两部分,L0是输出的左32位,R0是右32位。例,设置换前的输入值为D1D2D3…D64,则经过初始置换后的结果为:L0=D58D50…D8;R0=D57D49…D7.其置换规则如表1所示。
DES加密过程最后的逆置换IP^-1,是表1的逆过程。就是把原来的每一位都恢复过去,即把第1位的数据,放回到第58位,把第2位的数据,放回到第50位。
表 1
2. 获取子密钥Ki:DES加密算法的密钥长度为56位,一般表示为64位(每个第8位用于奇偶校验),将用户提供的64位初始密钥经过一系列的处理得到K1,K2,…,K16,分别作为1~16轮运算的16个子密钥。
(1). 将64位密钥去掉8个校验位,用密钥置换PC-1(表2)置换剩下的56位密钥;
表2
(2). 将56位分成前28位C0和后28位D0,即PC-1(K56)=C0D0;
(3). 根据轮数,这两部分分别循环左移1位或2位,表3:
表3
(4). 移动后,将两部分合并成56位后通过压缩置换PC-2(表4)后得到48位子密钥,即Ki=PC-2(CiDi).
表4
子密钥产生如图2所示:
图2 子密钥产生流程图
3. 密码函数F(非线性的)
(1). 函数F的操作步骤:密码函数F 的输入是32比特数据和48比特的子密钥:
A.扩展置换(E):将数据的右半部分Ri从32位扩展为48位。位选择函数(也称E盒),如表5所示:
表 5
B.异或:扩展后的48位输出E(Ri)与压缩后的48位密钥Ki作异或运算;
C.S盒替代:将异或得到的48位结果分成八个6位的块,每一块通过对应的一个S盒产生一个4位的输出。
S盒的具体置换过程(行和列均从0开始计数):某个Si盒的6位输入的第1位和第6位形成一个2位的二进制数,对应表中的某一行;输入的中间4位构成4位二进制数对应表中的某一列;第8个S盒的输入为001011,对应第8个S盒的第1行第5列(数为6),就用6(0110)代替原输入001011.
下面给出选择函数Si(i=1,2,…….,8)的功能表:
表 6 S1盒
表 7 S2盒
在此以S1为例说明其功能,在S1中,共有4行数据,命名为0,1,2,3行;每行有16列,命名为0,1,2,3,….,14,15列。现设输入为:D=D1D2D3D4D5D6,令:列=D2D3D4D5,行=D1D6;然后在S1表中查的对应的数,以4位二进制表示,此即为选择函数S1的输出。
(2)、D、P盒置换:将八个S盒的输出连在一起生成一个32位的输出,输出结果再通过置换P产生一个32位的输出即:F(Ri,Ki),F(Ri,Ki)算法描述如图3,最后,将P盒置换的结果与最初的64位分组的左半部分异或,然后,左、右半部分交换,开始下一轮计算。
图 3 F(Ri, Ki)计算
4. 密文输出:经过16次迭代运算后,得到L16、R16,将此作为输入,进行逆置换,即得到密文输出。逆置换正好是初始置的逆运算。例如,第1位经过初始置换后,处于第40位,而通过逆置换,又将第40位换回到第1位,其逆置换规则如表8所示:
表 8 逆置换规则
图4为DES算法加密原理图:
图 4 DES算法加密原理图
DES算法加密和解密过程采用相同的算法,并采用相同的加密密钥和解密密钥,两者的区别是:(1)、DES加密是从L0、R0到L15、R15进行变换,而解密时是从L15、R15到L0、R0进行变换的;(2)、加密时各轮的加密密钥为K0K1…K15,而解密时各轮的解密密钥为K15K14…K0;(3)、加密时密钥循环左移,解密时密钥循环右移。
DES加密过程分析:
(1)、首先要生成64位密钥,这64位的密钥经过“子密钥算法”换转后,将得到总共16个子密钥。将这些子密钥标识为Kn(n=1,2,…,16)。这些子密钥主要用于总共十六次的加密迭代过程中的加密工具。
(2)、其次要将明文信息按64位数据格式为一组,对所有明文信息进行分组处理。每一段的64位明文都要经过初试置换IP,置换的目的是将数据信息全部打乱重排。然后将打乱的数据分为左右两块,左边一块共32位为一组,标识为L0;右边一块也是32位为一组,标识为R0.
(3)、置换后的数据块总共要进行总共十六次的加密迭代过程。加密迭代主要由加密函数f来实现。首先使用子密钥K1对右边32位的R0进行加密处理,得到的结果也是32位的;然后再将这个32位的结果数据与左边32位的L0进行模2处理,从而再次得到一个32位的数据组。我们将最终得到的这个32位组数据,作为第二次加密迭代的R1,往后的每一次迭代过程都与上述过程相同。
(4)、在结束了最后一轮加密迭代之后,会产生一个64位的数据信息组,然后我们将这个64位数据信息组按原有的数据排列顺序平均分为左右两等分,然后将左右两等分的部分进行位置调换,即原来左等分的数据整体位移至右侧,而原来右等分的数据则整体位移至左侧,这样经过合并后的数据将再次经过逆初始置换IP^-1的计算,我们最终将得到一组64位的密文。
DES解密过程分析:DES的解密过程与它的加密过程是一样的,这是由于DES算法本身属于对称密码体制算法,其加密和解密的过程可以共用同一个过程和运算。
DES加密函数f:在DES算法中,要将64位的明文顺利加密输出成64位的密文,而完成这项任务的核心部分就是加密函数f。加密函数f的主要作用是在第m次的加密迭代中使用子密钥Km对Km-1进行加密操作。加密函数f在加密过程中总共需要运行16轮。
十六轮迭代算法:它先将经过置换后的明文分成两组,每组32位;同时密钥也被分成了两组,每组28位,两组密钥经过运算,再联合成一个48位的密钥,参与到明文加密的运算当中。S盒子,它由8个4*16的矩阵构成,每一行放着0到15的数据,顺序各个不同,是由IBM公司设计好的。经过异或运算的明文,是一个48位的数据,在送入到S盒子的时候,被分成了8份,每份6位,每一份经过一个S盒子,经过运算后输出为4位,即是一个0到15的数字的二进制表示形式。具体运算过程为,将输入的6位中的第1位为第6位合并成一个二进制数,表示行号,其余4位也合并成一个二进制数,表示列号。在当前S盒子中,以这个行号和列号为准,取出相应的数,并以二进制的形式表示,输出,即得到4位的输出,8个S盒子共计32位。
DES算法优缺点:
(1)、产生密钥简单,但密钥必须高度保密,因而难以做到一次一密;
(2)、DES的安全性依赖于密钥的保密。攻击破解DES算法的一个主要方法是通过密钥搜索,使用运算速度非常高的计算机通过排列组合枚举的方式不断尝试各种可能的密钥,直到破解为止。一般,DES算法使用56位长的密钥,通过简单计算可知所有可能的密钥数量最多是2^56个。随着巨型计算机运算速度的不断提高,DES算法的安全性也将随之下降,然而在一般的民用商业场合,DES的安全性仍是足够可信赖的。
(3)、DES算法加密解密速度比较快,密钥比较短,加密效率很高但通信双方都要保持密钥的秘密性,为了安全还需要经常更换DES密钥。
openssl, include/des.h(des_old.h)文件中函数说明:
1. DES_random_key:generates a random key. The PRNG must be seeded prior to using this function(see L<rand(3)|rand(3)>). If thePRNG could not generate a secure key, 0 is returned.
3. DES_set_key:works like DES_set_key_checked() if the I<DES_check_key> flag isnon-zero, otherwise like DES_set_key_unchecked().
4. DES_set_odd_parity:sets the parity of the passed I<key> to odd.
5. DES_is_weak_key:returns 1 is the passed key is a weak key, 0 if it is ok.
6. DES_ecb_encrypt:the basic DES encryption routine that encrypts or decrypts a single 8-byteI<DES_cblock> in I<electronic code book> (ECB) mode.
7. DES_ecb3_encrypt:encrypts/decrypts the I<input> block by using three-key Triple-DESencryption in ECB mode. This involves encrypting the input with I<ks1>,decrypting with the key schedule I<ks2>, and then encrypting withI<ks3>. This routine greatlyreduces the chances of brute force breaking of DES and has the advantage of ifI<ks1>, I<ks2> and I<ks3> are the same, it is equivalent tojust encryption using ECB mode and I<ks1> as the key.
8. DES_ecb2_encrypt:The macro is provided to perform two-key Triple-DES encryption by usingI<ks1> for the final encryption.
9. DES_ncbc_encrypt:encrypts/decrypts using the I<cipher-block-chaining> (CBC) mode of DES. If theI<encrypt> argument is non-zero, the routine cipher-block-chain encryptsthe cleartext data pointed to by the I<input> argument into theciphertext pointed to by the I<output> argument, using the key scheduleprovided by the I<schedule> argument, and initialization vector providedby the I<ivec> argument. If the I<length>argument is not an integral multiple of eight bytes, the last block is copiedto a temporary area and zero filled. Theoutput is always an integral multiple of eight bytes.
10. DES_xcbc_encrypt:is RSA's DESX(DESX是DES的一个改进版本,原理是利用一个随机的二进制数与加密前的数据以及解密后的数据异或) mode of DES. It usesI<inw> and I<outw> to 'whiten' the encryption. I<inw> and I<outw> are secret (unlikethe iv) and are as such, part of the key. So the key is sort of 24 bytes. This is much better than CBC DES.
11. DES_ede3_cbc_encrypt:implements outer triple CBC DES encryption with three keys. This mode is usedby SSL.
12. DES_ede2_cbc_encrypt:The macro implements two-key Triple-DES by reusing I<ks1> for the finalencryption. This form of Triple-DES is used by the RSAREF library.
13. DES_pcbc_encrypt:encrypt/decrypts using the propagating cipher block chaining mode used byKerberos v4. Its parameters are the same as DES_ncbc_encrypt.
14. DES_cfb_encrypt:encrypt/decrypts using cipher feedback mode. This method takes an array of characters as input and outputs and arrayof characters. It does not require anypadding to 8 character groups. Note: the I<ivec> variable is changed andthe new changed value needs to be passed to the next call to this function. Since this function runs a complete DES ECBencryption per I<numbits>, this function is only suggested for use whensending small numbers of characters.
15. DES_cfb64_encrypt:implements CFB mode of DES with 64bit feedback. this routine will allow you toencrypt an arbitrary number of bytes, no 8 byte padding. Each call to this routine will encrypt theinput bytes to output and then update ivec and num.
16. DES_ede3_cfb64_encrypt:is the same as DES_cfb64_encrypt except that Triple-DES is used.
17. DES_ede2_cfb64_encrypt:is the same as DES_cfb64_encrypt except that Triple-DES is used.
19. DES_ofb64_encrypt:is the same as DES_cfb64_encrypt using Output Feed Back mode.
20. DES_ede3_ofb64_encrypt:is the same as DES_ofb64_encrypt, using Triple-DES.
21. DES_ede2_ofb64_encrypt:is the same as DES_ofb64_encrypt, using Triple-DES.
22. DES_cbc_cksum:produces an 8 byte checksum based on the input stream (via CBCencryption). The last 4 bytes of thechecksum are returned and the complete 8 bytes are placed in I<output>.This function is used by Kerberos(网络认证协议) v4.
23. DES_quad_cksum:is a Kerberos v4 function. It returns a4 byte checksum from the input bytes. The algorithm can be iterated over the input, depending onI<out_count>, 1, 2, 3 or 4 times. If I<output> is non-NULL, the 8 bytes generated by each pass arewritten into I<output>.
24. DES_fcrypt:is a fast version of the Unix crypt(3) function. This version takes only a small amount ofspace relative to other fast crypt() implementations. This is different to the normal crypt in thatthe third parameter is the buffer that the return value is written into. It needs to be at least 14 bytes long. This function is thread safe, unlike thenormal crypt.
25. DES_crypt:is a faster replacement for the normal system crypt(). This function callsDES_fcrypt() with a static array passed as the third parameter. This emulates the normal non-thread safesemantics of crypt(3).
26. DES_enc_write:writes I<len> bytes to file descriptor I<fd> from bufferI<buf>. The data is encrypted via I<pcbc_encrypt> (default) usingI<sched> for the key and I<iv> as a starting vector. The actual data send down I<fd>consists of 4 bytes (in network byte order) containing the length of thefollowing encrypted data. The encrypted datathen follows, padded with random data out to a multiple of 8 bytes.
27. DES_enc_read:is used to read I<len> bytes from file descriptor I<fd> into bufferI<buf>. The data being read from I<fd> is assumed to have come fromDES_enc_write() and is decrypted using I<sched> for the key schedule andI<iv> for the initial vector.
Note: (1).ECB mode is not suitable for mostapplications; (2). DES_3cbc_encrypt is flawed and must not beused in applications. (3).DES_cbc_encrypt does not modify B<ivec>; useDES_ncbc_encrypt instead. (4). In OpenSSL 0.9.7, all des_ functions wererenamed to DES_ to avoid clashes with older versions of libdes.
Des modes: the variants of DES and othercrypto algorithms of OpenSSL.
Several crypto algorithms for OpenSSL can beused in a number of modes. Those areused for using block ciphers in a way similar to stream ciphers, among otherthings.
1、 ElectronicCodebook Mode (ECB): (1). Normally, this is found as the functionI<algorithm>_ecb_encrypt();(2). 64 bits are enciphered at a time;(3). The order of the blocks can be rearranged without detection; (4). The sameplaintext block always produces the same ciphertext block(for the same key)making it vulnerable to a 'dictionary attack'; (5). An error will only affect oneciphertext block.
2、 CipherBlock Chaining Mode (CBC): (1). Normally, this is found as the functionI<algorithm>_cbc_encrypt(). Be aware that des_cbc_encrypt() is not reallyDES CBC (it does not update the IV); use des_ncbc_encrypt() instead; (2). amultiple of 64 bits are enciphered at a time; (3). The CBC mode produces the sameciphertext whenever the same plaintext is encrypted using the same key andstarting variable; (3). The chaining operation makes the ciphertextblocks dependent on the current and all preceding plaintext blocks andtherefore blocks can not be rearranged; (4). The use of different startingvariables prevents the same plaintext enciphering to the same ciphertext; (5). An errorwill affect the current and the following ciphertext blocks.
3、 CipherFeedback Mode (CFB): (1). Normally, this is found as the functionI<algorithm>_cfb_encrypt(); (2). a number of bits (j) <= 64 areenciphered at a time; (3). The CFB mode produces the same ciphertextwhenever the same plaintext is encrypted using the same key and startingvariable; (4). The chaining operation makes the ciphertextvariables dependent on the current and all preceding variables and thereforej-bit variables are chained together and can not be rearranged; (5). The useof different starting variables prevents the same plaintext enciphering to thesame ciphertext; (6). The strength of the CFB mode depends on thesize of k (maximal if j == k). In myimplementation this is always the case; (7). Selection of a small value for jwill require more cycles through the encipherment algorithm per unit ofplaintext and thus cause greater processing overheads; (8). Onlymultiples of j bits can be enciphered; (9). An error will affect the currentand the following ciphertext variables.
4、 OutputFeedback Mode (OFB): (1). Normally, this is found as the functionI<algorithm>_ofb_encrypt(); (2). a number of bits (j) <= 64 areenciphered at a time; (3). The OFB mode produces the same ciphertextwhenever the same plaintext enciphered using the same key and startingvariable. Moreover, in the OFB mode thesame key stream is produced when the same key and start variable are used. Consequently, for security reasons a specificstart variable should be used only once for a given key; (4). Theabsence of chaining makes the OFB more vulnerable to specific attacks; (5). The useof different start variables values prevents the same plaintext enciphering tothe same ciphertext, by producing different key streams; (6). Selectionof a small value for j will require more cycles through the enciphermentalgorithm per unit of plaintext and thus cause greater processing overheads;(7). Only multiples of j bits can be enciphered; (8). OFB modeof operation does not extend ciphertext errors in the resultant plaintextoutput. Every bit error in theciphertext causes only one bit to be in error in the deciphered plaintext; (9). OFB modeis not self-synchronizing. If the twooperation of encipherment and decipherment get out of synchronism, the systemneeds to be re-initialized; (10). Each re-initialization should usea value of the start variable different from the start variable values usedbefore with the same key. The reason forthis is that an identical bit stream would be produced each time from the sameparameters. This would be susceptible toa 'known plaintext' attack.
5、 TripleECB Mode: (1). Normally, this is found as the functionI<algorithm>_ecb3_encrypt(); (2). Encrypt with key1, decrypt withkey2 and encrypt with key3 again; (2). As for ECB encryption butincreases the key length to 168 bits. There are theoretic attacks that can beused that make the effective key length 112 bits, but this attack also requires2^56 blocks of memory, not very likely, even for the NSA; (3). If bothkeys are the same it is equivalent to encrypting once with just one key; (4). If thefirst and last key are the same, the key length is 112 bits. There are attacksthat could reduce the effective key strength to only slightly more than 56bits, but these require a lot of memory; (5). If all 3 keys are the same, thisis effectively the same as normal ecb mode.
6、 TripleCBC Mode: (1). Normally, this is found as the functionI<algorithm>_ede3_cbc_encrypt(); (2). Encrypt with key1, decrypt withkey2 and then encrypt with key3; (3). As for CBC encryption butincreases the key length to 168 bits with the same restrictions as for tripleecb mode.
参考文献:
1、 《基于DES和ECC混合加密算法的数字签名研究与应用》
2、 openssl/doc
相关文章:

200行代码解读TDEngine背后的定时器
作者 | beyondma来源 | CSDN博客导读:最近几周,本文作者几篇有关陶建辉老师最新的创业项目-TdEngine代码解读文章出人意料地引起了巨大的反响,原以为C语言已经是昨日黄花,不过从读者的留言来看,C语言还是老当益壮&…

fastJson结合Nutz.Mapl的进阶应用
为什么80%的码农都做不了架构师?>>> 今天要做一堆数据的序列化, 反序列化, 序列化没问题, 反序列化却遇到了点小意外, 这一堆数据不是一个类!!!!!!当然可以通过类内部的一个类型对象来判断, 但是fastJson并没有这个功能, 只能自己一个一个的遍历一个一个…

OpenCV实现遍历文件夹下所有文件
OpenCV中有实现遍历文件夹下所有文件的类Directory,它里面包括3个成员函数:(1)、GetListFiles:遍历指定文件夹下的所有文件,不包括指定文件夹内的文件夹;(2)、GetListFolders:遍历指定文件夹下的所有文件夹…

阿里、京东、快手、华为......他们是如何构建一个个推荐系统“帝国”的?
推荐系统在人们的日常生活中随处可见,成为我们生命中不可或缺的一部分。作为当今应用最为广泛和成熟的 AI 技术之一,它是信息生产者、传播者与用户之间的桥梁,可以让信息最精准、最高效地到达需求不一的用户面前。每天打开手机或电脑端的大部…

前端基础_ES6
声明 三大关键字声明变量:var (ES5语法) let (ES6语法)声明常量:const (ES6语法) var 声明变量特性1、支持 函数作用域2、支持 JS预解析 (所谓变量提升)3、支持 重复声明 ÿ…

5大典型模型测试单机训练速度超对标框架,飞桨如何做到?
导读:飞桨(PaddlePaddle)致力于让深度学习技术的创新与应用更简单。在单机训练速度方面,通过高并行、低开销的异步执行策略和高效率的核心算子,优化静态图训练性能,在Paddle Fluid v1.5.0的基准测试中&…

windowsXP用户被禁用导致不能网站登录
1、查看系统事件,发现弹出如下的错误 2、根据上面的错误,我们很容易就可以判断是禁用了账户引起的 2.1后面进入计算机管理,再进入用户管理 2.2双击点开Internet来宾用于,发现此用户已经停用了。 2.3双击点开与IIS访问有关用户&…

从头到尾使用Geth的说明-3-geth参数说明和环境配置
1.参数说明 ETHEREUM选项:--config value TOML 配置文件--datadir "/home/user4/.ethereum" 数据库和keystore密钥的数据目录--keystore keystore存放目录(默认在datadir内)--nousb …

OpenSSL中对称加密算法DES常用函数使用举例
主要包括3个文件: 1. cryptotest.h:#ifndef _CRYPTOTEST_H_ #define _CRYPTOTEST_H_#include <string>using namespace std;typedef enum {GENERAL 0,ECB,CBC,CFB,OFB,TRIPLE_ECB,TRIPLE_CBC }CRYPTO_MODE;string DES_Encrypt(const string cleartext, const…

从原理到落地,七大维度读懂协同过滤推荐算法
作者丨gongyouliu来源 | 大数据与人工智能导语:本文会从协同过滤思想简介、协同过滤算法原理介绍、离线协同过滤算法的工程实现、近实时协同过滤算法的工程实现、协同过滤算法应用场景、协同过滤算法的优缺点、协同过滤算法落地需要关注的几个问题等7个方面来讲述。…

sql查询语句优化需要注意的几点
为了获得稳定的执行性能,SQL语句越简单越好。对复杂的SQL语句,要设法对之进行简化。 常见的简化规则如下: 1)不要有超过5个以上的表连接(JOIN) 2)考虑使用临时表或表变量存放中间结果。 3&#…

决策树算法原理(ID3,C4.5)
决策树算法原理(CART分类树) CART回归树 决策树的剪枝 决策树可以作为分类算法,也可以作为回归算法,同时特别适合集成学习比如随机森林。 1. 决策树ID3算法的信息论基础 1970年昆兰找到了用信息论中的熵来度量决策树的决策选择过程,昆兰把这…

对称加密算法之RC4介绍及OpenSSL中RC4常用函数使用举例
RC4是一种对称密码算法,它属于对称密码算法中的序列密码(streamcipher,也称为流密码),它是可变密钥长度,面向字节操作的流密码。 RC4是流密码streamcipher中的一种,为序列密码。RC4加密算法是Ron Rivest在1987年设计出的密钥长度…

SpringMVC中实现的token,防表单重复提交
一:首先创建一个token处理类 ,这里的类名叫 TokenHandlerprivate static Logger logger Logger.getLogger(TokenHandler.class);static Map<String, String> springmvc_token new HashMap<String, String>();//生成一个唯一值的tokenSupp…

利用CxImage实现编解码Gif图像代码举例
Gif(Graphics Interchange Format,图形交换格式)是由CompuServe公司在1987年开发的图像文件格式,分为87a和89a两种版本。Gif是基于LZW算法的无损压缩算法。Gif图像是基于颜色表的,最多只支持8位(256色)。Gif减少了图像调色板中的色彩数量&…

SpringBoot b2b2c 多用户商城系统 ssm b2b2c
来源: SpringBoot b2b2c 多用户商城系统 ssm b2b2c用java实施的电子商务平台太少了,使用spring cloud技术构建的b2b2c电子商务平台更少,大型企业分布式互联网电子商务平台,推出PC微信APP云服务的云商平台系统,其中包括…

AI“生死”落地:谁有资格入选AI Top 30+案例?
2019 年,人工智能应用落地的重要性正在逐步得到验证,这是关乎企业生死攸关的一环。科技巨头、AI 独角兽还有起于草莽的创业公司在各领域进行着一场多方角斗。进行平台布局的科技巨头们,正在加快承载企业部署 AI 应用的步伐,曾经无…

liunx 下su 和sudo 的区别
一. 使用 su 命令临时切换用户身份1、su 的适用条件和威力su命令就是切换用户的工具,怎么理解呢?比如我们以普通用户beinan登录的,但要添加用户任务,执行useradd ,beinan用户没有这个权限,而这个权限恰恰由…
非对称加密算法之RSA介绍及OpenSSL中RSA常用函数使用举例
RSA算法,在1977年由Ron Rivest、Adi Shamirh和LenAdleman,在美国的麻省理工学院开发完成。这个算法的名字,来源于三位开发者的名字。RSA已经成为公钥数据加密标准。 RSA属于公开密钥密码体制。公开密钥体制就是产生两把密钥,一把…

依图科技CEO朱珑:“智能密度”对AI发展意味着什么?
8月9日,由中央网信办、工业和信息化部、公安部联合指导,厦门市政府主办的“中国人工智能峰会”于厦门召开。中国工程院院士、北京大学教授高文,依图科技创始人兼CEO朱珑博士等出席峰会并发表了主题演讲。当前,人工智能正在扮演越来…

Office 2016使用NTKO OFFICE控件提示“文件存取错误”的解决办法
2019独角兽企业重金招聘Python工程师标准>>> 之前使用NTKO,电脑安装的说OFFICE2007,但是前2天电脑固态硬盘坏了 ,重新安装了系统,安装的说win10和office2016,再访问网站使用ntko时,却提示“文件存取错误”&…
如何制作一个类似Tiny Wings的游戏 Cocos2d-x 2.1.4
在第一篇《如何使用CCRenderTexture创建动态纹理》基础上,增加创建动态山丘,原文《How To Create A Game Like Tiny Wings with Cocos2D 2.X Part 1》,在这里继续以Cocos2d-x进行实现。有关源码、资源等在文章下面给出了地址。 步骤如下&…

腾讯优图开源业界首个3D医疗影像大数据预训练模型
整理 | Jane出品 | AI科技大本营(ID:rgznai100)近日,腾讯优图首个医疗AI深度学习预训练模型 MedicalNet 正式对外开源。这也是全球第一个提供多种 3D 医疗影像专用预训练模型的项目,将为全球医疗AI发展提供基础。许多研…

接口冲突的一种解决方法
问题描述:在一个大的项目中往往会包括很多模块,会有不同的部门或公司来负责实现某个模块,也有可能有第三方或客户的参与。假如他们都用到了某个开源软件,底层模块根据自身的需求对这个开源软件进行了修改或裁减。上层也用到了此开…

程序员:请你不要对业务「置之不理」
成长是条孤独的路,一个人会走得更快;有志同道合者同行,会走得更远。本篇内容整理自 21 天鲲鹏新青年计划线上分享内容。鲲鹏新青年计划是由 TGO 鲲鹏会组织的线上分享活动,希望能帮助更多同学一起学习、成长。12 月 28 日…

史上最简单的人脸识别项目登上GitHub趋势榜
来源 | GitHub Trending整理 | Freesia译者 | TommyZihao出品 | AI科技大本营(ID: rgznai100)导读:近日,一个名为 face_recognition 的人脸识别项目登上了 GitHub Trending 趋势榜,赚足了眼球。自开源至截稿࿰…

Centos 64位 Install certificate on apache 即走https协议
2019独角兽企业重金招聘Python工程师标准>>> 一: 先要apache 请求ssl证书的csr 一下是步骤: 重要注意事项 An Important Note Before You Start 在生成CSR文件时同时生成您的私钥,如果您丢了私钥或忘了私钥密码,则颁发 证书给您…

C/C++中“#”和“##”的作用和用法
在C/C的宏中,”#”的功能是将其后面的宏参数进行字符串化操作(Stringfication),简单说就是在对它所引用的宏变量通过替换后在其左右各加上一个双引号。而”##”被称为连接符(concatenator),用来将两个子串Token连接为一个Token。注意这里连接…
国贫县山西永和:“一揽子”保险“保”脱贫
永和是吕梁山特困连片地区的深度贫困县,生产生活条件极差。 范丽芳 摄 永和是吕梁山特困连片地区的深度贫困县,生产生活条件极差。 范丽芳 摄 中新网太原1月16日电 题:国贫县山西永和:“一揽子”保险“保”脱贫 作者范丽芳 李海金…
内存泄漏检测工具VLD在VS2010中的使用举例
Visual LeakDetector(VLD)是一款用于Visual C的免费的内存泄露检测工具。它的特点有:(1)、它是免费开源的,采用LGPL协议;(2)、它可以得到内存泄露点的调用堆栈,可以获取到所在文件及行号;(3)、它可以得到泄露内存的完整…