⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 文档.txt

📁 des加密解密的实现,能够加密任意文件,任意长度
💻 TXT
📖 第 1 页 / 共 5 页
字号:
  输入:           lr (Base), ln (Exponent), m (Modulus )             
  输出:           -                                                     
  返回值:         Remainder of lr ^ ln mod m





  功能:          Binary left-/rightshift by n bits               
  格式:          const LINT shift (const LINT& a, const int noofbits)            
  输入:          a (Operand)                                                  
                 noofbits (Number of places to be shifted)                      
                 negative sign: Shift right                                     
                 positive sign: Shift left                     
  输出:          -                                                      
  返回值:        Shifted value





  功能:          Probabilistic primality test acc. to Miller-Rabin (MR-Test)               
  格式:          const int isprime (const LINT& p, const int noofsmallprimes, const int iterations)            
  输入:          p (Number to be tested),                                     
                 noofsmallprimes (Number of small primes for the sieve)       
                 iterations (Number of rounds for the MR-Test.                  
                 If iterations == 0 the optimized number of rounds  
                 for an error probability < 2^-80 is used.)                
  输出:          -                                                      
  返回值:        1: n_l probably prime                                          
                 0: n_l definitely not prime 





  
  功能:           Calculate number of bits of a LINT operand                    
            (Integral part of base-2-logarithm + 1)               
  格式:           const unsigned int ld (const LINT& a)          
  输入:           a(Argument)             
  输出:           -                                                     
  返回值: 	  Number of relevant binary digits of a 





  功能:           Greatest Common Divisor of two LINT operands              
  格式:           const LINT gcd (const LINT& a, const LINT& b)           
  输入:           a,b(Operands)             
  输出:           -                                                     
  返回值:         GCD of a and b





  功能:           Extended Euclidean Algorithm                                   
                  Greatest Common Divisor d = GCD(a, b) and linear combination              
                  d = au + bv                          
  格式:           const LINT xgcd (const LINT& a, const LINT& b , LINT& u, int& sign_u, LINT& v, int& sign_v)          
  输入:           a_l, b_l (Operands)             
  输出:           u_l, v_l (Factors of the linear combination  d = au + bv    with signs in sign_u and sign_v)                                                                                   
  返回值:         GCD of a_l and b_l





  功能:           Inverse of a modulo n             
  格式:           const LINT inv (const LINT& a, const LINT& b)          
  输入:           a (Operand), b (Modulus)             
  输出:           -                                                    
  返回值:         inverse of a mod b
		  If gcd > 1 the inverse does not exist, the inverse is set to zero then





  功能:           Factor 2^t of a CLINT operand n, such that n = 2^t * b, b odd              
  格式:           const int twofact (const LINT& even, LINT& odd)          
  输入:           even (Argument)            
  输出:           odd (Odd factor of even)                                                      
  返回值:         Logarithm t fo the factor 2^t of even 





  功能:           Generation of a prime number p with 2^(l-1) <= p < 2^l            
  格式:           const LINT findprime (const USHORT l)         
  输入:           l (exponent)           
  输出:           -                                                     
  返回值:         the prime number p





  功能:            Generation of a prime number p with 2^(l-1) <= p < 2^l  and gcd (p - 1, f) = 1                  
  格式:            const LINT findprime (const USHORT l, const LINT& f)         
  输入:            l (exponent), f           
  输出:            -                                                   
  返回值:          the prime number p





  功能:             Generation of a prime number p pmin <= p <= pmax and gcd (p - 1, f) = 1            
  格式:             const LINT findprime (const LINT& pmin, const LINT& pmax, const LINT& f)       
  输入:             pmin, pmax, f        
  输出:             -                                                   
  返回值:     	    the prime number p





  功能:	    check if p is even or not
  格式:            const int iseven (const LINT& p)
  输入:	            p
  输出:		    -
  返回值: 	    true if p is even
    
	


  
  功能:            check if p is odd or not	       
  格式:            const int isodd (const LINT& p)
  输入:             p
  输出:	 	    -
  返回值:  	    true if p is odd





  功能:	    Test whether two LINT operands are equal modulo m
  格式:  	    const int mequ (const LINT& a, const LINT& b, const LINT& m)
  输入: 	    LINT a, b (Values to compare), LINT m (Modulus) 
  输出:		    -
  返回值:            1          : a_l = b_l mod m_l                                 
         	     0          : a_l != b_l mod m_l                                
         





  功能:	    Generation of a pseudorandom number of type LINT
  格式:	    LINT randl (const int l)
  输入:		    l (Number of binary digits to be generated)
  输出:	 	    -
  返回值:	    Generated pseuorandom number





  功能:	    Generation of a pseudorandom number of type LINT between rmin and rmax
  格式:            LINT randl (const LINT& rmin, const LINT& rmax)
  输入:             l (Number of binary digits to be generated), rmin, rmax
  输出:	            -
  返回值:           Generated pseuorandom number





  功能:	    Initialization  of 64 pseudo-random number generator Based on the linear congruence  ,the initial value is seed 
  格式:            void seedl (const LINT& seed)
  输入:	            seed
  输出:             -
  返回值:           -





  功能:	    Generation of a pseudorandom number of type LINT,its digit is l
  格式:	    LINT randBBS (const int l)
  输入:             l(the length of the number)
  输出:             -
  返回值:	    Generated pseudorandom number





  功能:	    Generation of a pseudorandom number of type LINT between rmin and rmax
  格式:	    LINT randBBS (const LINT& rmin, const LINT& rmax)
  输入: 	    rmin, rmax
  输出:		    -
  返回值:  	    Generated pseudorandom number





  
  功能:	    Initialization of the BLUM-BLUM-SHUB pseudorandom number generator with seed      
  格式: 	    int seedBBS (const LINT& seed)
  输入:		    seed
  输出:             -
  返回值:           E_CLINT_OK : Everything O.K.                                   
		    -1: Seed and modulus not coprime                               


 下面的成员函数的用途和上述的友元函数相同,只是输入参数减少一个,因为使用了this,即使用了对象本身的参数。
// Member functions
  // Arithmetic

  const LINT& add (const LINT&);
  const LINT& sub (const LINT&);
  const LINT& mul (const LINT&);
  const LINT& sqr (void);
  const LINT& divr (const LINT&, LINT&);
  const LINT& mod (const LINT&);
  //const LINT& mod2 (const USHORT);

  // Modular arithmetic

  const LINT& madd (const LINT&, const LINT&);
  const LINT& msub (const LINT&, const LINT&);
  const LINT& mmul (const LINT&, const LINT&);
  const LINT& msqr (const LINT&);
  const LINT& mexp (const LINT&, const LINT&);
  const LINT& mexp (const USHORT, const LINT&);
  const LINT& mexpkm (const LINT&, const LINT&);
  const LINT& shift (const int);

  // Number theoretic member Funktionen

  const LINT gcd (const LINT&) const;
  const LINT xgcd (const LINT&, LINT&, int&, LINT&, int&) const;
  const LINT inv (const LINT&) const;
  const int twofact (LINT&) const;
  const unsigned int ld (void) const;
  const int isprime (const int noofsmallprimes = 302, const int iterations = 0) const;
  const LINT issqr (void) const;
  const int mequ (const LINT&, const LINT&) const;
   const int iseven (void) const;
  const int isodd (void) const;




  

  功能:	    Setting of a single bit
  格式:            const LINT& LINT::setbit (const unsigned int pos)
  输入:             pos (Position of the bit to be set )  
  输出:             -
  返回值:           the number after set


          

  

                                 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -