Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
help me — Gideros Forum

help me

Unknown Member
edited November 2017 in General questions
Here is my test code.

local key = "AAAAAAAAAAAAAAAA"
local iv = "0123456789abcdef"

local str = Cryptography.aesEncrypt("Hello, world!", key, iv, 1)
local str_2 = Cryptography.aesDecrypt(str, key, iv, 1)

print(str, str_2)


The string is encrypted, but when it's decrypted there are 3 extra characters at the end. These characters are EXT (end of text) codes.
http://giderosmobile.com/download

Comments

  • hgy29hgy29 Maintainer
    Seems to be ok here. I ran:
    local key = "AAAAAAAAAAAAAAAA"
    local iv = "0123456789abcdef"
     
    local str = Cryptography.aesEncrypt("Hello, world!", key, iv, 1)
    local str_2 = Cryptography.aesDecrypt(str, key, iv, 1)
     
    print(("%02x,"):rep(#str):format(str:byte(1,#str)))
    print(str_2)
    print(("%02x,"):rep(#str_2):format(str_2:byte(1,#str_2)))
    and got:
    65,26,41,48,73,24,b0,9d,b2,10,4d,e0,83,d2,77,1b,
    Hello, world!
    48,65,6c,6c,6f,2c,20,77,6f,72,6c,64,21,
    No extra chars in decoded string...
  • EricCarrEricCarr Member
    edited November 2017
    It also looks fine to me. You don't want to print an encrypted string plain to the text window, as it will show corrupted. Use the cool hex format example that hgy29 provided.

    Testing by concatenating to the ends of the string:
    local key = "AAAAAAAAAAAAAAAA"
    local iv = "0123456789abcdef"
     
    local str = Cryptography.aesEncrypt("Hello, world!", key, iv, 1)
    local str_2 = Cryptography.aesDecrypt(str, key, iv, 1)
     
    print(":" .. str_2 .. ":")
    Outputs:
    :Hello, world!:
Sign In or Register to comment.