class Net::NTLM::EncodeUtil

Public Class Methods

decode_utf16le(str) click to toggle source

Decode a UTF16 string to a ASCII string @param [String] str The string to convert

# File lib/net/ntlm/encode_util.rb, line 10
def self.decode_utf16le(str)
  Kconv.kconv(swap16(str), Kconv::ASCII, Kconv::UTF16)
end
encode_utf16le(str) click to toggle source

Encodes a ASCII string to a UTF16 string @param [String] str The string to convert

# File lib/net/ntlm/encode_util.rb, line 16
def self.encode_utf16le(str)
  swap16(Kconv.kconv(str, Kconv::UTF16, Kconv::ASCII))
end
swap16(str) click to toggle source

Taggle the strings endianness between big/little and little/big @param [String] str The string to swap the endianness on

# File lib/net/ntlm/encode_util.rb, line 22
def self.swap16(str)
  str.unpack("v*").pack("n*")
end