Poke Register AES_MODE_REG[2:0]

Here we can discuss about the problem found
User avatar
cicciocb
Site Admin
Posts: 2781
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 592 times
Been thanked: 1990 times
Contact:

Re: Poke Register AES_MODE_REG[2:0]

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Sat Nov 23, 2024 3:26 pm Hello cicciocb,
Thank you for implementing the AES128 function.
I've been trying to get it to work for a while.
Unfortunately I can't manage to place a hex "00" in the key or in the plain.
I've also tried IObuff.FromHex - unfortunately without success.
In the plaintext and in the Key$, a &H00 is difficult because it is a string.

Code: [Local Link Removed for Guests]

'key$ = "my_Personal_key1"             ' Sets the crypting key
'key$ = "my" + chr$(95) + "Personal_key1"             ' Sets the crypting key
key$ = "my" + chr$(00) + "Personal_key1"             ' Sets the crypting key
wlog key$
IObuff.FromString(0, "Hello, World!") ' Converts a string into IO Buffer
print IObuff.Encrypt(0, key$)         ' Encrypts using a 16 characters key
wlog IObuff.ToHex$(0)                 ' Shows the result in Hex format
wlog IObuff.Decrypt(0, key$)  ' Decrypts using the same key
wlog IObuff.ToString$(0)   ' shows the decrypted string (same as the original)

Invalid Key line 6
23/11/2024 16:17:05 -> Program Stopped

Cheers Bishopxxl
What is the module that you are using? I'll compile a version for testing for you
Bishopxxl
Posts: 18
Joined: Tue Oct 08, 2024 5:47 pm
Has thanked: 22 times
Been thanked: 6 times

Re: Poke Register AES_MODE_REG[2:0]

Post by Bishopxxl »

Hi, cicciocb

I could live with the AES128 key without &H00, as my device does not have &H00 in the key.
But if a key had a 00 in the future, it would be a problem.

Would it be possible to pass an Array(16) or

IOBUFF.DIM(0, 16) = 1, 2, 0, 4, 5, 6, 7, 8, 255, 10, 111, 12, 13, 14, 152, 16
as a key and then a

IOBUFF.WRITE (1, position, value)
as plain text and then a

print IObuff.Encrypt(1, 0) to encrypt it?

or am I thinking too simply ;)

cheers Bishopxxl
Bishopxxl
Posts: 18
Joined: Tue Oct 08, 2024 5:47 pm
Has thanked: 22 times
Been thanked: 6 times

Re: Poke Register AES_MODE_REG[2:0]

Post by Bishopxxl »

Hi,
grafik.png
You do not have the required permissions to view the files attached to this post.
User avatar
cicciocb
Site Admin
Posts: 2781
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 592 times
Been thanked: 1990 times
Contact:

Re: Poke Register AES_MODE_REG[2:0]

Post by cicciocb »

I just uploaded the version 1.70.3 that contains a fix.

try this code

Code: [Local Link Removed for Guests]

key$ = "my_Personal_key1"             ' Sets the crypting key (16 chars)
IObuff.FromHex(0,"41424344004546470048") ' this is ABCD\0EFG\0H"
wlog IObuff.ToHex$(0)                 ' Shows the result in Hex format
print IObuff.Encrypt(0, key$)         ' Encrypts using a 16 characters key
wlog IObuff.ToHex$(0)                 ' Shows the result in Hex format
wlog IObuff.Decrypt(0, key$)  ' Decrypts using the same key
wlog IObuff.ToString$(0)   ' the string will show only ABCD (because there is a \0 in the string)
wlog IObuff.ToHex$(0) ' but in Hex will be shown as the original
I'll update the function in the future to take into account also the &h00 in the key
Bishopxxl
Posts: 18
Joined: Tue Oct 08, 2024 5:47 pm
Has thanked: 22 times
Been thanked: 6 times

Re: Poke Register AES_MODE_REG[2:0]

Post by Bishopxxl »

Hello my genius,
the example works perfectly. :D :D :D :D :D :D

I'll play around with it now , if my wife lets me :)
By the way, big compliments on the CRC implementation - VERY comfortable and universal !!!
I'll back in the next few days -

Thank you very very much for your support and have a nice evening!!!

Cheers Bishopxxl
You do not have the required permissions to view the files attached to this post.
Post Reply