Skip to content

Implementation is not AES #4

Description

@TiberiumFusion

It seems like the the AES implementation in AES.lua is not actually AES. This library is consistent with itself, but not with the rest of the world.

Comparison against .NET's RijndaelManaged and OpenSSL

ECB-256 Encryption

Key: 68C756C6C186436C9EC51C174C32AE81761389B5E5904E30BA57CCD911290ECC
Plaintext: my secret, with extra length so that it is waaaay over 16 bytes. (64 chars)
Ciphertext:

  • Lua_AES: 5281a86fc7c4dfb409fcfc937a644912beed7732ad3bd09d540f36926abbe445d4aa6f90ccc075ce0fdbe968ddb1b4e9257c536c55c3153a45e8b30e23f961d7
  • .NET & OpenSSL: 375b2fcf832d21eec0baa29c145872ee8b3228a2d26e221a9647e42993e3f8584a26862cc40ea90129a7ef3462fa0fe7a865d8404bfd83f7ba60cf470e363f8a

ECB-256 Decryption

Key: 68C756C6C186436C9EC51C174C32AE81761389B5E5904E30BA57CCD911290ECC
Ciphertext: 375b2fcf832d21eec0baa29c145872ee8b3228a2d26e221a9647e42993e3f8584a26862cc40ea90129a7ef3462fa0fe7a865d8404bfd83f7ba60cf470e363f8a
Decrypted plaintext:

  • Lua_AES:
 t▒▒]`▒)>▒▒D▒▒▒▒(▒nnD▒▒▒zYc▒k`▒▒▒Y▒▒5`I▒W▒=
▒▒▒▒▒\t▒▒@▒▒E▒▒_▒2n,▒M▒̧▒?$▒L
                            ▒_Z▒*▒W<▒5▒Ǔ▒jO▒▒▒<#ħ▒▒D▒▒t▒▒f_▒<R
  • .NET & OpenSSL: my secret, with extra length so that it is waaaay over 16 bytes.

Tested with LuaJIT.
I had to modify schedule256() to accept a hex string as a key, since I don't know of any Lua distribution that has native 256-bit integers. (see: main.lua line 2)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions