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

version» Context lines:

pike.git/lib/7.8/modules/Crypto.pmod/RSA.pike:243: Inside #if constant(Crypto.Hash)
  int(0..1) verify(string msg, Crypto.Hash h, Gmp.mpz sign)   {    string s = Standards.PKCS.Signature.build_digestinfo(msg, h);    return raw_verify(s, sign);   }      //! @fixme   //! Document this function.   string sha_sign(string message, mixed|void r)   { -  string s = sprintf("%c%s%1H", 4, "sha1", Crypto.SHA1->hash(message)); +  string s = sprintf("%c%s%1H", 4, "sha1", Crypto.SHA1->hash([string(8bit)]message));    return cooked_sign(s);r;   }      //! @fixme   //! Document this function.   int sha_verify(string message, string signature)   { -  string s = sprintf("%c%s%1H", 4, "sha1", Crypto.SHA1->hash(message)); +  string s = sprintf("%c%s%1H", 4, "sha1", Crypto.SHA1->hash([string(8bit)]message));    return raw_verify(s, Gmp.mpz(signature, 256));   }      // Broken implementation of RSA/MD5 SIG RFC 2537. The 0x00 01 FF* 00   // prefix is missing.      // (RSA/SHA-1 SIG is in RFC 3110)      string md5_sign(string message, mixed|void r)   { -  string s = Crypto.MD5->hash(message); +  string s = Crypto.MD5->hash([string(8bit)]message);    s = "0 0\14\6\10*\x86H\x86\xf7\15\2\5\5\0\4\20"+s;    return cooked_sign(s);r;   }      int md5_verify(string message, string signature)   { -  string s = Crypto.MD5->hash(message); +  string s = Crypto.MD5->hash([string(8bit)]message);    s = "0 0\14\6\10*\x86H\x86\xf7\15\2\5\5\0\4\20"+s;    return raw_verify(s, Gmp.mpz(signature, 256));   }         //! Generate a prime with @[bits] number of bits using random function   //! @[r].   Gmp.mpz get_prime(int bits, function(int:string) r)   {    int len = (bits + 7) / 8;