class SSHKey

def self.ssh_public_key_data_dsarsa(val)

def self.ssh_public_key_data_dsarsa(val)
  # Get byte-representation of absolute value of val
  data = val.to_s(2)
  first_byte = data[0,1].unpack("c").first
  if val < 0
    # For negative values, highest bit must be set
    data[0] = [0x80 & first_byte].pack("c")
  elsif first_byte < 0
    # For positive values where highest bit would be set, prefix with \0
    data = "\0" + data
  end
  data
end