B4R Question Byte array not empty (=x00) when defined?

KMatle

Expert
Licensed User
Longtime User
I mentioned that a byte array is not empty after you create it. This got me into some trouble while en-/decrypting with AES :)

B4X:
Dim Mess(256) As Byte
Log("Mess as HEX: ", bc.HexFromBytes(Mess))

The output is:

B4X:
1C0000000000000000000000FD1400400D150040FFFFFFFFC8150840000000006C1C0940C495F83F000000000000000000000000FFFF3FB3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012260D80401DFB3FCC15FC3F681DFB3F640000006500000066000000F8FFFFFFE7370D80601DFB3F02000000020000005463F93F0F0000000200000014000000301F0D80D01DFB3F010000003C0EFC3F9103403F661DFB3F7820FB3F65DCFB3F8403403F66DCFB3F010000006C1C0940443C0D80660000009103403F64000000A81EFB3F801DFB3F7820FB3F1B21FB3FF93C0D80B01DFB3F801DFB3F

I assume it just reserves storage without "cleaning" it, correct? So one always needs to initialize it by code?
 

thetahsk

Active Member
Licensed User
Longtime User
I mentioned that a byte array is not empty after you create it. This got me into some trouble while en-/decrypting with AES :)

try to increase your #StackBufferSize

B4X:
Mess as HEX: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 
Last edited:
Upvote 0

KMatle

Expert
Licensed User
Longtime User
try to increase your #StackBufferSize

B4X:
Mess as HEX: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Stacksize is now

B4X:
#StackBufferSize: 20000

but no change, except: If it is defined in Process_Globals, it's initilized with x00. Defined in a sub, it's filled with random values. Could you check that, too?
 
Upvote 0
Top