1509aa8ef6
Some code has been removed. Version control is not synonymous with code storage - if you're not using it now, you probably don't have working tests and the code will be buggy anyway. Write it when you need it.
25 lines
571 B
Ruby
25 lines
571 B
Ruby
module Net
|
|
class LDAP
|
|
module Extensions
|
|
module Bignum
|
|
|
|
def to_ber
|
|
# 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
|
|
result = []
|
|
|
|
n = self
|
|
while n>0
|
|
b = n & 0xff
|
|
result << b
|
|
n = n >> 8
|
|
end
|
|
|
|
"\002" + ([result.size] + result.reverse).pack('C*')
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|
|
end |