Method: Wework::Cipher#pack

Defined in:
lib/wework/cipher.rb

#pack(content, app_id) ⇒ Object

app_id or corp_id



37
38
39
40
41
42
43
# File 'lib/wework/cipher.rb', line 37

def pack(content, app_id)
  random = SecureRandom.hex(8)
  text = content.force_encoding('ASCII-8BIT')
  msg_len = [text.length].pack('N')

  encode_padding("#{random}#{msg_len}#{text}#{app_id}")
end