@@ -223,12 +223,29 @@ ossl_bn_alloc(VALUE klass)
223
223
224
224
/*
225
225
* call-seq:
226
- * OpenSSL::BN.new(bn) => aBN
227
- * OpenSSL::BN.new(integer) => aBN
228
- * OpenSSL::BN.new(string) => aBN
229
- * OpenSSL::BN.new(string, 0 | 2 | 10 | 16) => aBN
226
+ * OpenSSL::BN.new(bn) -> aBN
227
+ * OpenSSL::BN.new(integer) -> aBN
228
+ * OpenSSL::BN.new(string, base = 10) -> aBN
230
229
*
231
- * Construct a new OpenSSL BIGNUM object.
230
+ * Construct a new \OpenSSL BIGNUM object.
231
+ *
232
+ * If +bn+ is an Integer or OpenSSL::BN, a new instance of OpenSSL::BN
233
+ * representing the same value is returned. See also Integer#to_bn for the
234
+ * short-hand.
235
+ *
236
+ * If a String is given, the content will be parsed according to +base+.
237
+ *
238
+ * +string+::
239
+ * The string to be parsed.
240
+ * +base+::
241
+ * The format. Must be one of the following:
242
+ * - +0+ - MPI format. See the man page BN_mpi2bn(3) for details.
243
+ * - +2+ - Variable-length and big-endian binary encoding of a positive
244
+ * number.
245
+ * - +10+ - Decimal number representation, with a leading '-' for a negative
246
+ * number.
247
+ * - +16+ - Hexadeciaml number representation, with a leading '-' for a
248
+ * negative number.
232
249
*/
233
250
static VALUE
234
251
ossl_bn_initialize (int argc , VALUE * argv , VALUE self )
@@ -296,16 +313,21 @@ ossl_bn_initialize(int argc, VALUE *argv, VALUE self)
296
313
297
314
/*
298
315
* call-seq:
299
- * bn.to_s => string
300
- * bn.to_s(base) => string
316
+ * bn.to_s(base = 10) -> string
301
317
*
302
- * === Parameters
303
- * * _base_ - Integer
304
- * Valid values:
305
- * * 0 - MPI
306
- * * 2 - binary
307
- * * 10 - the default
308
- * * 16 - hex
318
+ * Returns the string representation of the bignum.
319
+ *
320
+ * BN.new can parse the encoded string to convert back into an OpenSSL::BN.
321
+ *
322
+ * +base+::
323
+ * The format. Must be one of the following:
324
+ * - +0+ - MPI format. See the man page BN_bn2mpi(3) for details.
325
+ * - +2+ - Variable-length and big-endian binary encoding. The sign of
326
+ * the bignum is ignored.
327
+ * - +10+ - Decimal number representation, with a leading '-' for a negative
328
+ * bignum.
329
+ * - +16+ - Hexadeciaml number representation, with a leading '-' for a
330
+ * negative bignum.
309
331
*/
310
332
static VALUE
311
333
ossl_bn_to_s (int argc , VALUE * argv , VALUE self )
0 commit comments