青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

S.l.e!ep.¢%

像打了激速一樣,以四倍的速度運轉,開心的工作
簡單、開放、平等的公司文化;尊重個性、自由與個人價值;
posts - 1098, comments - 335, trackbacks - 0, articles - 1
  C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

about des_encrypt()

Posted on 2010-01-22 10:51 S.l.e!ep.¢% 閱讀(1128) 評論(0)  編輯 收藏 引用

des_encrypt() -- SSLeay 0.9.0b -- January 1999

NAME

des_encrypt, des_encrypt2, des_ecb_encrypt, des_cbc_encrypt, des_ncbc_encrypt,
des_xcbc_encrypt, des_pcbc_encrypt, des_cfb_encrypt, des_cfb64_encrypt,
des_ofb_encrypt, des_ofb64_encrypt -- DES encryption

SYNOPSIS

#include "des.h"

void des_encrypt(data,ks,enc)
unsigned long *data;
des_key_schedule ks; int enc;

void des_encrypt2(data,ks,enc)
unsigned long *data;
des_key_schedule ks; int enc;

void des_ecb_encrypt(input,output,ks,enc)
des_cblock *input, *output;
des_key_schedule ks; int enc;

void des_cbc_encrypt(input,output,length,ks,ivec,enc)
des_cblock *input, *output, *ivec;
long length;
des_key_schedule ks;
int enc;

void des_ncbc_encrypt(input,output,length,ks,ivec,enc)
des_cblock *input, *output, *ivec;
long length;
des_key_schedule ks;
int enc;

void des_xcbc_encrypt(input,output,length,ks,ivec,inw,outw,enc)
des_cblock *input, *output, *ivec, *inw, *outw;
des_cblock *output;
long length;
des_key_schedule ks;
int enc;

void des_pcbc_encrypt(input,output,length,ks,ivec,enc)
des_cblock *input, *output, *ivec;
long length;
des_key_schedule ks;
int enc;

void des_cfb_encrypt(in,out,numbits,length,ks,ivec,enc)
unsigned char *input, *output;
int numbits, enc;
long length;
des_key_schedule ks;
des_cblock *ivec;

void des_cfb64_encrypt(in,out,length,ks,ivec,num,enc)
unsigned char *in, *out;
long length;
des_key_schedule ks;
des_cblock *ivec;
int *num, enc;

void des_ofb_encrypt(in,out,numbits,length,ks,ivec)
unsigned char *in, *out;
int numbits;
long length;
des_key_schedule ks;
des_cblock *ivec;

void des_ofb64_encrypt(in,out,length,ks,ivec,num)
unsigned char *in, *out;
long length;
des_key_schedule ks;
des_cblock *ivec;
int *num;

DESCRIPTION

In any function prototype which has arguments input and output, the same variable can be passed for both arguments.

des_encrypt() is the basic building block used by all of the other DES encryption routines. It should be used only to implement a DES mode that the library doesn't already supply.

des_encrypt operates on data which is a pointer to two DES_LONGs (at least 4 characters per element, maybe more depending on how large a long is on your machine, but in that case, the extra bytes are treated as padding). In order to make this work right, each function implementing a DES mode does conversion of the input block, essentially a string of characters, to an array of DES_LONGs before invoking des_encrypt. After the encryption the function does the reverse conversion. Here's an example (from ecb_enc.c):

void des_ecb_encrypt(input, output, ks, encrypt)
des_cblock (*input);
des_cblock (*output);
des_key_schedule ks;
int encrypt;
        {
        register DES_LONG l;
        register unsigned char *in,*out;
        DES_LONG ll[2];

        in=(unsigned char *)input;
        out=(unsigned char *)output;
        c2l(in,l); ll[0]=l;
        c2l(in,l); ll[1]=l;
        des_encrypt(ll,ks,encrypt);
        l=ll[0]; l2c(l,out);
        l=ll[1]; l2c(l,out);
        l=ll[0]=ll[1]=0;
        }

ks is a previously-initialized des_key_schedule.

enc takes either the value DES_ENCRYPT, in which case encryption is performed, or DES_DECRYPT, in which case decryption is performed.

des_encrypt2() is identical to des_encrypt except that the DES initial permutation (IP) and final permutation (FP) have been left out. Again, this function should not be used except to implement new DES modes.

It is currently used to implement the various triple-DES modes.

(IP() des_encrypt2() des_encrypt2() des_encrypt2() FP()
is the same as
des_encrypt() des_encrypt() des_encrypt()
except faster :-).)

des_ecb_encrypt() is the Electronic Code Book form of DES, the most basic form of the algorithm. The des_cblock pointed to by input is encrypted into the block pointed to by output (which may be the same as input) using the key represented by ks. enc takes either the value DES_ENCRYPT, in which case encryption is performed, or DES_DECRYPT, in which case decryption is performed.

des_cbc_encrypt() implements DES in Cipher Block Chaining mode. The des_cblocks pointed to by input are encrypted (or decrypted) to the blocks pointed to by output.

Length should contain the number of des_cblocks * 8 (i.e. the total length of the input).

If length is not a multiple of 8, the results are unpredictable.

ivec is used to hold the output cipher text before calling the function again, if you are encrypting a text in several separate calls. This output is typically used in some way to modify the algorithm so that, if you use one of the chaining or feedback modes, encryption of the same block of text does not always give the same output (but encryption of the same block of text, with the same ivec in place, will typically give the same output).

See DES encryption modes overview for a discussion of the various modes.

For more details about the modes, see FIPS Pub 81: DES Modes of Operation; this is the updated version from May of 1996.

Unfortunately, this function does not automatically update ivec; the user must do it by copying in the last 8 bytes of output cipher text into ivec before the next call to this function.

ivec must be initialized to some known (but randomly generated) state before calling this function on the first chunk of data (and when you decrypt the data, the same initialization needs to be used for the first decryption call).

For example (from destest.c),

    des_cbc_encrypt((C_Block *)cbc_data,(C_Block *)cbc_out,
         (long)strlen((char *)cbc_data)+1,ks,
         (C_Block *)cbc_iv,DES_ENCRYPT);
    des_cbc_encrypt((C_Block *)cbc_out,(C_Block *)cbc_in,
         (long)strlen((char *)cbc_data)+1,ks,
         (C_Block *)cbc_iv,DES_DECRYPT);

where cbc_iv has been initialized previously by the user.

des_ncbc_encrypt() is identical to des_cbc_encrypt except that it does the update of ivec automatically. For tha reason it should be used in preference to des_cbc_encrypt whenever possible.

des_xcbc_encrypt() is RSA's DESX mode of DES. It uses inw and outw, supplied by the user, to 'whiten' the key. These should be nice random strings like the DES key unless the user is choosing them manually.

DESX is defined as key1 xor (des ( key2 xor input ) ), where the des encryption is done with a third key key3. Here, inw is keyn, and outw is keyn.

This substantially strengthens the algorithm against exhaustive search of the key space; see DES algorithm references for more details.

des_pcbc_encrypt() is the Propagating Cipher Block Chaining mode of DES. It is used by Kerberos v4. Its parameters are the same as des_ncbc_encrypt().

des_cfb_encrypt() is the Cipher Feedback mode of DES. This implementation 'feeds back' in numbit blocks. The input in) and the output out is in multiples of numbits bits, and numbit should be a multiple of 8 bits. length is the number of bytes in in.

If numbits is not a multiple of 8 bits, the extra bits in the bytes will be considered padding. For example, if numbits is 12, for each 2 input bytes, the 4 high bits of the second byte will be ignored. So to encode 72 bits when using numbits of 12 takes 12 bytes. To encode 72 bits when using numbits of 9 will take 16 bytes. To encode 80 bits when using numbits of 16 will take 10 bytes, and so on. This padding factor applies to both in and out.

ivec is used to keep intermediate results for subsequent calls, and as input to the function the first time it is called on a text.

It should be initialized to a known (but randomly generated) state before this function is called on the first part of a piece of data.

ks is a key schedule that has been previously set by des_set_key.

enc takes either the value DES_ENCRYPT, in which case encryption is performed, or DES_DECRYPT, in which case decryption is performed.

des_cfb64_encrypt() implements the Cipher Feedback Mode of DES, with 64 bit feedback. The arguments are the same as for des_cfb_encrypt except that there is no numbits argument, because there is no padding factor, and there is an additional num argument which is updated by the function along with ivec after each call.

The num argument is updated to show how many bytes of the ivec have been used; one step in the algorithm includes the xor of a byte of the plaintext with a byte of the (encrypted) ivec, so that all 8 bytes of the ivec are used in turn for an input block of 8 bytes. As each byte of the ivec is used, a new byte is created by the algorithm and stuffed into the ivec in place of the used byte. The following byte would be used next, and so on. num can be thought of as a pointer into the ivec to show which byte to start xor-ing with, the next time the function is called.

des_ofb_encrypt() is a implementation of the Output Feedback mode of DES. Its parameters are the same as those of des_cfb_encrypt() except that there is no < b>argument; encryption and decryption use the same arguments. in and out must be multiples of numbits long, numbits should be a multiple of 8 bits, and if it is not, the same padding factor comes into play.

Note that there is no enc parameter; this algorithm functions the same for encryption and decryption.

des_ofb64_encrypt() implements the Output Feedback Mode of DES, with 64 bit feedback. The arguments are the same as for des_cfb64_encrypt.


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            一本一道久久综合狠狠老精东影业| 久久久午夜视频| 国产欧美精品一区aⅴ影院| 亚洲青涩在线| 亚洲国产精品悠悠久久琪琪| 久久国产天堂福利天堂| 久久久噜噜噜久久久| 国产亚洲一区二区三区在线播放| 亚洲伊人网站| 久久激情五月丁香伊人| 国产专区欧美专区| 久久精品视频99| 你懂的国产精品| 亚洲精品国产精品乱码不99| 裸体一区二区三区| 亚洲国产人成综合网站| 亚洲精品偷拍| 欧美精品一卡| 这里只有精品视频在线| 小嫩嫩精品导航| 国产欧美日韩视频一区二区三区| 欧美在线视频日韩| 欧美成人综合网站| 99re这里只有精品6| 欧美性理论片在线观看片免费| 亚洲一区二区三区精品在线| 久久久av水蜜桃| 91久久夜色精品国产九色| 欧美成人视屏| 在线中文字幕一区| 久久午夜电影| 亚洲免费观看在线观看| 蜜臀久久99精品久久久画质超高清| 国产精品hd| 午夜在线成人av| 免费欧美在线视频| av成人免费| 国产精自产拍久久久久久蜜| 久久国产精品久久久| 欧美激情a∨在线视频播放| 一本色道久久综合亚洲精品婷婷| 国产精品色网| 久久天堂国产精品| 在线午夜精品自拍| 久久九九电影| 99在线热播精品免费99热| 国产欧美精品va在线观看| 久久综合色综合88| 一本久久综合亚洲鲁鲁五月天| 久久久久久亚洲精品杨幂换脸| 亚洲美女黄色| 禁断一区二区三区在线| 欧美午夜精品| 欧美 日韩 国产一区二区在线视频| 亚洲一区二区高清| 亚洲国产你懂的| 欧美伊人影院| 日韩午夜av| 狠狠色综合网站久久久久久久| 欧美日韩精品二区第二页| 久久国产精品久久w女人spa| 亚洲精品视频一区| 久久综合婷婷| 欧美一区二区免费视频| 亚洲精品视频二区| 黑人巨大精品欧美一区二区 | 一区二区免费在线观看| 狠狠色狠狠色综合日日小说 | 亚洲综合日韩中文字幕v在线| 欧美ab在线视频| 欧美中文字幕久久| 9国产精品视频| 亚洲国产欧美在线人成| 国产精品久久久久一区二区三区 | 亚洲免费av电影| 久久婷婷蜜乳一本欲蜜臀| 亚洲欧美成人网| 夜夜夜精品看看| 亚洲成色最大综合在线| 国产日韩一级二级三级| 国产精品久久影院| 欧美日韩亚洲一区二区| 欧美凹凸一区二区三区视频| 欧美一级久久| 欧美一区二区三区久久精品茉莉花| 亚洲五月婷婷| 亚洲影视在线| 亚洲制服少妇| 一区二区三区色| 一区二区三区欧美在线观看| 最新中文字幕一区二区三区| 欧美电影免费网站| 免费黄网站欧美| 欧美成人日韩| 亚洲国产精品va在线观看黑人| 久久人人精品| 久久人体大胆视频| 鲁大师成人一区二区三区| 久久全球大尺度高清视频| 性欧美videos另类喷潮| 亚洲专区国产精品| 小黄鸭精品密入口导航| 欧美一区亚洲| 久久久欧美精品sm网站| 欧美中文字幕久久| 午夜精品福利一区二区三区av| 欧美三区在线| 欧美日韩在线高清| 欧美日韩在线直播| 国产精品久久久久久久免费软件| 国产精品久久综合| 国产精品毛片大码女人| 国产精品网站一区| 国产亚洲网站| 亚洲电影免费观看高清完整版在线| 亚洲国产美女精品久久久久∴| 亚洲黄色尤物视频| 一区二区三区毛片| 午夜精品福利在线| 久久久亚洲国产美女国产盗摄| 欧美mv日韩mv亚洲| 亚洲精品久久嫩草网站秘色| 亚洲精品欧美日韩| 亚洲欧美国产三级| 久久九九久精品国产免费直播| 久久亚洲一区二区| 欧美日韩在线不卡| 国内精品视频在线观看| 亚洲欧洲一区二区天堂久久| 亚洲香蕉网站| 久久成人精品视频| 欧美激情第9页| 日韩视频在线观看| 久久精品二区三区| 欧美伦理视频网站| 国产亚洲人成网站在线观看| 亚洲国产mv| 亚洲欧美视频在线观看| 久久亚洲精品视频| 日韩午夜在线观看视频| 午夜精品视频在线观看| 欧美大片免费观看| 国产日产欧美一区| 99热在这里有精品免费| 久久精品国产第一区二区三区最新章节 | 精品成人一区二区三区| 亚洲国产精品久久久久久女王| 99视频一区二区| 久久久久国产一区二区三区四区| 亚洲国产黄色| 欧美一区二区黄色| 欧美理论片在线观看| 国产日韩欧美另类| 日韩一区二区高清| 久久久久久久性| 一区二区欧美在线| 美女视频黄a大片欧美| 国产日韩欧美视频| 亚洲天堂视频在线观看| 久久女同精品一区二区| 一区二区三区高清在线| 久久综合五月天婷婷伊人| 国产欧美日韩亚洲一区二区三区 | 国产精品视频久久| 亚洲欧洲精品一区二区精品久久久| 香蕉成人伊视频在线观看| 欧美xxx成人| 欧美在线观看视频一区二区| 欧美日韩免费区域视频在线观看| 亚洲黄色天堂| 免费短视频成人日韩| 亚洲欧美成人精品| 欧美日韩精品是欧美日韩精品| 亚洲第一天堂av| 久久人人爽人人爽爽久久| 亚洲欧美国产高清| 国产精品激情| 在线综合视频| 亚洲国产视频直播| 男女视频一区二区| 亚洲国产一区二区在线| 欧美成人高清视频| 久久精品青青大伊人av| 国产日韩欧美一区二区三区四区 | 又紧又大又爽精品一区二区| 欧美一级一区| 国产一区二区中文| 亚洲第一在线综合网站| 香蕉久久一区二区不卡无毒影院| 欧美午夜片欧美片在线观看| 一区二区三区欧美激情| 久久久久久久久蜜桃| 麻豆av一区二区三区久久| 精久久久久久| 亚洲一区二区三区中文字幕| 91久久久一线二线三线品牌| 欧美成人网在线| 亚洲乱码国产乱码精品精天堂 | 亚洲美女av网站| 亚洲国产精品综合|