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

version» Context lines:

pike.git/lib/7.8/modules/Crypto.pmod/RSA.pike:156: Inside #if constant(Crypto.Hash)
      switch(type)    {    case 1:    cookie = sprintf("%@c", allocate(len, 0xff));    break;    case 2:    if (random)    cookie = replace(random(len), "\0", "\1");    else -  cookie = replace(Crypto.Random.random_string(len), "\0", "\1"); +  cookie = replace(Crypto.Random.random_string([int(0..)]len), "\0", "\1");    break;    default:    error( "Unknown type.\n" );    }    return Gmp.mpz(sprintf("%c", type) + cookie + "\0" + message, 256);   }      //! Reverse the effect of @[rsa_pad].   string rsa_unpad(Gmp.mpz block, int type)   {
pike.git/lib/7.8/modules/Crypto.pmod/RSA.pike:301: Inside #if constant(Crypto.Hash)
   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. 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; +  r = [function(int:string)]Crypto.Random.random_string;    if (bits < 128)    error( "Ridiculously small key.\n" );       /* NB: When multiplying two n-bit integers,    * you're most likely to get an (2n - 1)-bit result.    * We therefore add an extra bit to s2.    *    * cf [bug 6620].    */