【cos 源码下载】【测试大厅源码】【元歌源码】swap互联源码_swapidc源码

时间:2024-12-24 08:36:50 编辑:FF9CH的源码 来源:js源码外置

1.Hotswap之Mybatis热部署
2.des算法源代码
3.C语言中由小到大排序并a存放最小,互联c存放最大值?

swap互联源码_swapidc源码

Hotswap之Mybatis热部署

       在项目初期,源码c源面对Mybatis开发,互联编写XML或SQL时,源码c源cos 源码下载常常会遇到语法错误。互联常规情况下,源码c源修正后需重启项目,互联这一过程相当耗时。源码c源然而,互联IDEA的源码c源debugger模式提供类或XML文件热部署功能,却无法实现实时更新mybatis关系。互联测试大厅源码为解决这一问题,源码c源需添加更新mybatis关系的互联逻辑,实现热部署。源码c源

       在调试模式下,互联若需重新编译Mapper.class 或 Mapper.xml 文件,元歌源码这仅能实现文件重新加载。但要真正更新mybatis关系,需深入探究其源码。

       通过源码解析,关键在于了解Mybatis中的缘分居源码两个重要对象:mappedStatements和resultMaps。这些对象的value部分包含id,而key则不包含类名前缀,因此直接通过key删除操作并不适用。相反,应根据id来查询并删除,区块神兽源码考虑到不同的key可能共享相同的value,操作需更加细致。

       在处理XML文件时,重要的一点是文件路径信息。这些路径被记录在loadedResources中,通过文件名的后半部分即可确定对应的XML文件。因此,在处理重名问题时,确保文件命名的唯一性是至关重要的。

       最后,这一功能将会整合至名为SequenceOutline的插件中,进一步提升开发效率与便利性。

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 word Spbox[8][];

       SecBlock<word> 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=, 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=, 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=, 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=, 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 , which in turn borrowed heavily from Jim Gillogly's

       * public domain code. I pretty much kept my key scheduling 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, karn@unix.ka9q.ampr.org, August .

       */

       #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[] = {

       , , , , , , , 2,

       , , , , , , , 4,

       , , , , , , , 6,

       , , , , , , , 8,

       , , , , , , 9, 1,

       , , , , , , , 3,

       , , , , , , , 5,

       , , , , , , , 7

       };

       /* final permutation IP^-1 */

       static byte fp[] = {

       , 8, , , , , , ,

       , 7, , , , , , ,

       , 6, , , , , , ,

       , 5, , , , , , ,

       , 4, , , , , , ,

       , 3, , , , , , ,

       , 2, , , , , , ,

       , 1, , 9, , , ,

       };

       /* expansion operation matrix */

       static byte ei[] = {

       , 1, 2, 3, 4, 5,

       4, 5, 6, 7, 8, 9,

       8, 9, , , , ,

       , , , , , ,

       , , , , , ,

       , , , , , ,

       , , , , , ,

       , , , , , 1

       };

       /* The (in)famous S-boxes */

       static byte sbox[8][] = {

       /* S1 */

       , 4, , 1, 2, , , 8, 3, , 6, , 5, 9, 0, 7,

       0, , 7, 4, , 2, , 1, , 6, , , 9, 5, 3, 8,

       4, 1, , 8, , 6, 2, , , , 9, 7, 3, , 5, 0,

       , , 8, 2, 4, 9, 1, 7, 5, , 3, , , 0, 6, ,

       /* S2 */

       , 1, 8, , 6, , 3, 4, 9, 7, 2, , , 0, 5, ,

       3, , 4, 7, , 2, 8, , , 0, 1, , 6, 9, , 5,

       0, , 7, , , 4, , 1, 5, 8, , 6, 9, 3, 2, ,

       , 8, , 1, 3, , 4, 2, , 6, 7, , 0, 5, , 9,

       /* S3 */

       , 0, 9, , 6, 3, , 5, 1, , , 7, , 4, 2, 8,

       , 7, 0, 9, 3, 4, 6, , 2, 8, 5, , , , , 1,

       , 6, 4, 9, 8, , 3, 0, , 1, 2, , 5, , , 7,

       1, , , 0, 6, 9, 8, 7, 4, , , 3, , 5, 2, ,

       /* S4 */

       7, , , 3, 0, 6, 9, , 1, 2, 8, 5, , , 4, ,

       , 8, , 5, 6, , 0, 3, 4, 7, 2, , 1, , , 9,

       , 6, 9, 0, , , 7, , , 1, 3, , 5, 2, 8, 4,

       3, , 0, 6, , 1, , 8, 9, 4, 5, , , 7, 2, ,

       /* S5 */

       2, , 4, 1, 7, , , 6, 8, 5, 3, , , 0, , 9,

       , , 2, , 4, 7, , 1, 5, 0, , , 3, 9, 8, 6,

       4, 2, 1, , , , 7, 8, , 9, , 5, 6, 3, 0, ,

       , 8, , 7, 1, , 2, , 6, , 0, 9, , 4, 5, 3,

       /* S6 */

       , 1, , , 9, 2, 6, 8, 0, , 3, 4, , 7, 5, ,

       , , 4, 2, 7, , 9, 5, 6, 1, , , 0, , 3, 8,

       9, , , 5, 2, 8, , 3, 7, 0, 4, , 1, , , 6,

       4, 3, 2, , 9, 5, , , , , 1, 7, 6, 0, 8, ,

       /* S7 */

       4, , 2, , , 0, 8, , 3, , 9, 7, 5, , 6, 1,

       , 0, , 7, 4, 9, 1, , , 3, 5, , 2, , 8, 6,

       1, 4, , , , 3, 7, , , , 6, 8, 0, 5, 9, 2,

       6, , , 8, 1, 4, , 7, 9, 5, 0, , , 2, 3, ,

       /* S8 */

       , 2, 8, 4, 6, , , 1, , 9, 3, , 5, 0, , 7,

       1, , , 8, , 3, 7, 4, , 5, 6, , 0, , 9, 2,

       7, , 4, 1, 9, , , 2, 0, 6, , , , 3, 5, 8,

       2, 1, , 7, 4, , 8, , , , 9, 0, 3, 5, 6,

       };

       /* -bit permutation function P used on the output of the S-boxes */

       static byte pi[] = {

       , 7, , ,

       , , , ,

       1, , , ,

       5, , , ,

       2, 8, , ,

       , , 3, 9,

       , , , 6,

       , , 4,

       };

       #endif

       /* permuted choice table (key) */

       static const byte pc1[] = {

       , , , , , , 9,

       1, , , , , , ,

       , 2, , , , , ,

       , , 3, , , , ,

       , , , , , , ,

       7, , , , , , ,

       , 6, , , , , ,

       , , 5, , , , 4

       };

       /* number left rotations of pc1 */

       static const byte totrot[] = {

       1,2,4,6,8,,,,,,,,,,,

       };

       /* permuted choice key (table) */

       static const byte pc2[] = {

       , , , , 1, 5,

       3, , , 6, , ,

       , , , 4, , 8,

       , 7, , , , 2,

       , , , , , ,

       , , , , , ,

       , , , , , ,

       , , , , ,

       };

       /* End of DES-defined tables */

       /* bit 0 is left-most in byte */

       static const int bytebit[] = {

       ,,,,,,,

       };

       /* Set key (initialize key schedule array) */

       DES::DES(const byte *key, CipherDir dir)

       : k()

       {

       SecByteBlock buffer(++8);

       byte *const pc1m=buffer; /* place to modify pc1 into */

       byte *const pcr=pc1m+; /* place to rotate pc1 into */

       byte *const ks=pcr+;

       register int i,j,l;

       int m;

       for (j=0; j<; j++) { /* convert pc1 to bits of key */

       l=pc1[j]-1; /* integer bit location */

       m = l & ; /* 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<; i++) { /* key chunk for each iteration */

       memset(ks,0,8); /* Clear key schedule */

       for (j=0; j<; j++) /* rotate pc1 the right amount */

       pcr[j] = pc1m[(l=j+totrot[i])<(j<? : ) ? l: l-];

       /* rotate left and right halves independently */

       for (j=0; j<; j++){ /* select bits individually */

       /* 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] = ((word)ks[0] << )

       | ((word)ks[2] << )

       | ((word)ks[4] << 8)

       | ((word)ks[6]);

       k[2*i+1] = ((word)ks[1] << )

       | ((word)ks[3] << )

       | ((word)ks[5] << 8)

       | ((word)ks[7]);

       }

       if (dir==DECRYPTION) // reverse key schedule order

       for (i=0; i<; i+=2)

       {

       std::swap(k[i], k[-2-i]);

       std::swap(k[i+1], k[-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(word &left, word &right)

       {

       word work;

       work = ((left >> 4) ^ right) & 0x0f0f0f0f;

       right ^= work;

       left ^= work << 4;

       work = ((left >> ) ^ right) & 0xffff;

       right ^= work;

       left ^= work << ;

       work = ((right >> 2) ^ left) & 0x;

       left ^= work;

       right ^= (work << 2);

       work = ((right >> 8) ^ left) & 0xffff;

       left ^= work;

       right ^= (work << 8);

       right = rotl(right, 1);

       work = (left ^ right) & 0xaaaaaaaa;

       left ^= work;

       right ^= work;

       left = rotl(left, 1);

       }

       inline void FPERM(word &left, word &right)

       {

       word work;

       right = rotr(right, 1);

       work = (left ^ right) & 0xaaaaaaaa;

       left ^= work;

       right ^= work;

       left = rotr(left, 1);

       work = ((left >> 8) ^ right) & 0xffff;

       right ^= work;

       left ^= work << 8;

       work = ((left >> 2) ^ right) & 0x;

       right ^= work;

       left ^= work << 2;

       work = ((right >> ) ^ left) & 0xffff;

       left ^= work;

       right ^= work << ;

       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(word &left, word &right)

       {

       word work;

       right = rotl(right, 4U);

       work = (left ^ right) & 0xf0f0f0f0;

       left ^= work;

       right = rotr(right^work, U);

       work = (left ^ right) & 0xffff;

       left ^= work;

       right = rotr(right^work, U);

       work = (left ^ right) & 0x;

       left ^= work;

       right = rotr(right^work, 6U);

       work = (left ^ right) & 0xffff;

       left ^= work;

       right = rotl(right^work, 9U);

       work = (left ^ right) & 0xaaaaaaaa;

       left = rotl(left^work, 1U);

       right ^= work;

       }

       inline void FPERM(word &left, word &right)

       {

       word work;

       right = rotr(right, 1U);

       work = (left ^ right) & 0xaaaaaaaa;

       right ^= work;

       left = rotr(left^work, 9U);

       work = (left ^ right) & 0xffff;

       right ^= work;

       left = rotl(left^work, 6U);

       work = (left ^ right) & 0x;

       right ^= work;

       left = rotl(left^work, U);

       work = (left ^ right) & 0xffff;

       right ^= work;

       left = rotl(left^work, U);

       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

       {

       word l,r,work;

       #ifdef IS_LITTLE_ENDIAN

       l = byteReverse(*(word *)inBlock);

       r = byteReverse(*(word *)(inBlock+4));

       #else

       l = *(word *)inBlock;

       r = *(word *)(inBlock+4);

       #endif

       IPERM(l,r);

       const word *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 >> ) & 0x3f]

       ^ Spbox[0][(work >> ) & 0x3f];

       work = r ^ kptr[4*i+1];

       l ^= Spbox[7][(work) & 0x3f]

       ^ Spbox[5][(work >> 8) & 0x3f]

       ^ Spbox[3][(work >> ) & 0x3f]

       ^ Spbox[1][(work >> ) & 0x3f];

       work = rotr(l, 4U) ^ kptr[4*i+2];

       r ^= Spbox[6][(work) & 0x3f]

       ^ Spbox[4][(work >> 8) & 0x3f]

       ^ Spbox[2][(work >> ) & 0x3f]

       ^ Spbox[0][(work >> ) & 0x3f];

       work = l ^ kptr[4*i+3];

       r ^= Spbox[7][(work) & 0x3f]

       ^ Spbox[5][(work >> 8) & 0x3f]

       ^ Spbox[3][(work >> ) & 0x3f]

       ^ Spbox[1][(work >> ) & 0x3f];

       }

       FPERM(l,r);

       #ifdef IS_LITTLE_ENDIAN

       *(word *)outBlock = byteReverse(r);

       *(word *)(outBlock+4) = byteReverse(l);

       #else

       *(word *)outBlock = r;

       *(word *)(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

C语言中由小到大排序并a存放最小,c存放最大值?

       C代码和运行结果如下:

       利用选择排序的思想,先将最小数交换到a,再将次小数交换到b即可

       输出数值从小到大,结果正确,望采纳~

       附源码:

       #include <stdio.h>

       void swap(int *x, int *y) { // 交换两个数

           int tmp = *x;

           *x = *y;

           *y = tmp;

       }

       int main() {

           int a, b, c;

           scanf("%d%d%d", &a, &b, &c);

           // 选择排序,先选择最小数交换到a

           if (b < a) swap(&a, &b);

           if (c < a) swap(&a, &c);

           // 再判断b和c的大小

           if (c < b) swap(&b, &c);

           printf("a=%d, b=%d, c=%d\n", a, b, c);

           return 0;

       }

搜索关键词:网站换地址源码