lib/megar/crypto/support.rb
def prepare_key(a)
    pkey = [0x93C467E3, 0x7DB0C7A4, 0xD1BE3F81, 0x0152CB56]
    0x10000.times do
      (0..(a.length-1)).step(4) do |j|
        key = [0,0,0,0]
        4.times {|i| key[i] = a[i+j] if (i+j < a.length) }
        pkey = aes_encrypt_a32(pkey,key)
      end
    end
    pkey
  end
# Returns encrypted key given an array +a+ of 32-bit integers
#
# Javascript reference implementation: function prepare_key(a)
#
Returns encrypted key given an array +a+ of 32-bit integers
Javascript reference implementation: function prepare_key(a)
Returns encrypted key given an array + a + of 32 - bit integers Javascript reference implementation : function prepare_key ( a )
def prepare_key(a)
    pkey = [0x93C467E3, 0x7DB0C7A4, 0xD1BE3F81, 0x0152CB56]
    0x10000.times do
      (0..(a.length-1)).step(4) do |j|
        key = [0,0,0,0]
        4.times {|i| key[i] = a[i+j] if (i+j < a.length) }
        pkey = aes_encrypt_a32(pkey,key)
      end
    end
    pkey
  end
def prepare_key ( a ) pkey = [ 0x93C467E3 , 0x7DB0C7A4 , 0xD1BE3F81 , 0x0152CB56 ] 0x10000 . times do ( 0 .. ( a . length - 1 ) ) . step ( 4 ) do | j | key = [ 0 , 0 , 0 , 0 ] 4 . times { | i | key [ i ] = a [ i + j ] if ( i + j < a . length ) } pkey = aes_encrypt_a32 ( pkey , key ) end end pkey end
Returns encrypted key given an array +a+ of 32-bit integers
Javascript reference implementation: function prepare_key(a)
Returns encrypted key given an array + a + of 32 - bit integers Javascript reference implementation : function prepare_key ( a )
a