Shop OBEX P1 Docs P2 Docs Learn Events
How do I start at a different index point in a DAT data section? — Parallax Forums

How do I start at a different index point in a DAT data section?

Don MDon M Posts: 1,652
edited 2014-04-20 09:52 in Propeller 1
Let's say I have this in the DAT section:
data_out      byte $32, $2e, $30, $30, $2c, $52, $30, $30, $43, $30, $30, $2c, $4d, $41, $43, $3a       
              byte $30, $30, $30, $37, $38, $30, $37, $46, $41, $38, $44, $33, $00, $00, $00, $00


I'm playing with the AES object and it only encrypts 16 bytes at a time. I want to encrypt the second 16 bytes so how do I index data_out to do the second set of 16 bytes? The data _out is always going to be 32 bytes long.

The command from the AES object is like this:
aes.ECBEncrypt (@data_out, @ciphertext) 


Thanks.
Don

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-04-20 08:48
    aes.ECBEncrypt (@data_out[16], @ciphertext)

    BTW, you're making your life hard by translating the ASCII to hex by hand. Let the Spin compiler do that for you. Just enter your byte data as strings enclosed in quotes.

    -Phil
  • Don MDon M Posts: 1,652
    edited 2014-04-20 08:50
    Thanks Phil! That works. Happy Easter!
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-04-20 09:17
    You also add another name to the second half of the array.
    data_out0      byte $32, $2e, $30, $30, $2c, $52, $30, $30, $43, $30, $30, $2c, $4d, $41, $43, $3a       
    data_out1      byte $30, $30, $30, $37, $38, $30, $37, $46, $41, $38, $44, $33, $00, $00, $00, $00
    
    

    data_out0[16] references the same element as data_out1[0].
  • Don MDon M Posts: 1,652
    edited 2014-04-20 09:52
    Duane Degn wrote: »
    You also add another name to the second half of the array.
    data_out0      byte $32, $2e, $30, $30, $2c, $52, $30, $30, $43, $30, $30, $2c, $4d, $41, $43, $3a       
    data_out1      byte $30, $30, $30, $37, $38, $30, $37, $46, $41, $38, $44, $33, $00, $00, $00, $00
    
    

    data_out0[16] references the same element as data_out1[0].

    Thanks Duane. That I already knew I could do but wanted just one data name to deal with.
Sign In or Register to comment.