Module: Net::BER::Extensions::Bignum

### Home Classes Methods

### In Files

- lib/net/ber/core_ext/bignum.rb

### Methods

- #to_ber

### Files

- History.rdoc
- Manifest.txt

### Class/Module Index

Quicksearch

- Net
- Net::BER
- Net::BER::BERParser
- Net::BER::BerError
- Net::BER::BerIdentifiedArray
- Net::BER::BerIdentifiedNull
- Net::BER::BerIdentifiedOid
- Net::BER::BerIdentifiedString
- Net::BER::Extensions
- Net::BER::Extensions::Array
- Net::BER::Extensions::Bignum
- Net::BER::Extensions::FalseClass
- Net::BER::Extensions::Fixnum
- Net::BER::Extensions::String
- Net::BER::Extensions::TrueClass
- Net::LDAP
- Net::LDAP::Connection
- Net::LDAP::Connection::GetbyteForSSLSocket
- Net::LDAP::DN
- Net::LDAP::Dataset
- Net::LDAP::Entry
- Net::LDAP::Filter
- Net::LDAP::LdapControls
- Net::LDAP::LdapError
- Net::LDAP::PDU
- Net::LDAP::PDU::Error
- Net::LDAP::Password
- OpenSSL
- OpenSSL::SSL
- OpenSSL::SSL::SSLSocket

No matching classes.

# Net::BER::Extensions::Bignum

BER extensions to the Bignum class.

### Public Instance Methods

to_ber() click to toggle source

Converts a Bignum to an uncompressed BER integer.

    # File lib/net/ber/core_ext/bignum.rb, line 6
    def to_ber
      result = []

      # NOTE: Array#pack's 'w' is a BER _compressed_ integer. We need
      # uncompressed BER integers, so we're not using that. See also:
      # http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/228864
      n = self
      while n > 0
        b = n & 0xff
        result << b
        n = n >> 8
      end

      "\0002" + ([result.size] + result.reverse).pack('C*')
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.