pike.git / lib / modules / Crypto.pmod / RSA.pike

version» Context lines:

pike.git/lib/modules/Crypto.pmod/RSA.pike:1: - /* $Id: RSA.pike,v 1.2 2004/02/04 00:32:45 nilsson Exp $ + /* $Id: RSA.pike,v 1.3 2004/02/04 21:37:09 nilsson Exp $    *    * Follow the PKCS#1 standard for padding and encryption.    */      #pike __REAL_VERSION__   #pragma strict_types      #if constant(Gmp.mpz)      static Gmp.mpz n; /* modulo */
pike.git/lib/modules/Crypto.pmod/RSA.pike:280: Inside #if constant(Gmp.mpz)
   p = Gmp.mpz(sprintf("%c%s", (s[0] & (bit_to_set - 1))    | bit_to_set, s[1..]),    256)->next_prime();    } while (p->size() > bits);       return p;   }      //! Generate a valid RSA key pair with the size @[bits]. A random   //! function may be provided as arguemnt @[r], otherwise - //! @[Crypto.Random.random_string] will be used. + //! @[Crypto.Random.random_string] will be used. Keys must be at least + //! 128 bits.   this_program generate_key(int(128..) bits, function(int:string)|void r)   {    if (!r)    r = Crypto.Random.random_string;    if (bits < 128)    error( "Ridiculously small key.\n" );       int s1 = bits / 2; /* Size of the first prime */    int s2 = bits - s1;