B4J Question String to bytes handling with encryption - ThRuST    
Jul 4, 2022 load an encrypted string and decode it.
Please provide examples how you handle strings to byte.../DecodeBase64
when storing the encrypted string in an Array of Bytes. How to deal...
link: I have now updated B4XAES library to v2.0
Find it here
Check it out on all B4X platforms. I hope...
link: @Erel This looks extremely powerful. I'm speechless. I must test this. Hail to King Erel...
link: (EncryptedText)
Dim dec() As Byte = c.Decrypt(enc, Password)
Return BytesToString(dec, 0, dec...
B4R Question Byte() to string, string to byte in http request - RJB (first post)    
Sep 9, 2024   
(1 reaction)Shouldn't that be :
Dim a as string
Dim BC as byte ByteConverter
a = BC.StringFromBytes(Queue.FirstItem)
gotoweb(a)
Sub gotoweb (a As String) ...
link: . The string you created on the stack becomes invalid.
The solution is to use GlobalStore to store...
link: Dear friends , please, I have code:
dim a() as byte
a=byteconvert.StringFromBytes(Queue...
link: Dear Erel, dear friends,
edit of text is done.
Please for advice, what I am doing wrong.
Best...
B4A Code Snippet [B4X] Bytes To File - Erel    
May 24, 2020   
(19 reactions)   
tags: Image, Share Images, Bytes, B4X, B4X Bytes To FileThis code is no longer needed. Use File.WriteBytes / ReadBytes.
Write an array of bytes to a file and read a file into an array of bytes.
Sub BytesToFile (Dir As String, FileName As String, Data..., 0, Data.Length)
out.Close
End Sub
Sub FileToBytes (Dir As String, FileName As String) As Byte()
Return Bit.InputStreamToBytes(File.OpenInput(Dir, FileName))
End Sub
Note that you can convert complex objects (and simple objects) to bytes and vice versa with B4XSerializator from...
B4A Question Diffrence size of file in BitmapToString & ImageToBytes & File.ReadBytes - Erel (first post)    
Apr 29, 2024   
(1 reaction)Different jpeg encoder. Different jpeq quality setting....
link: is difference between ImageToBytes(Image As Bitmap) with File.ReadBytes(dir As String, fileName As String...
link: about 33% overhead (with the advantage of encoding the raw bytes as a valid string).
ImageToBytes...
link: .InitializeToBytesArray(1000)
bmp.WriteToStream(out, 100, "PNG")
out.Close
Dim su As StringUtils...
B4A Question string to Byte Array - Rusty    
Oct 24, 2015.StringToBytes(PaddedString, "UTF8")
Log("Data Len before " & data.Length)
If... bytes (I believe).
When I convert a string of standard ascii characters of 48 bytes to a byte array...
link: I still don't understand why Erel indicated
Please post a full code snippet WITH the algorythm ...
link: by B4XEncryption).
Anyway you can use ByteConverter.ArrayCopy to add the padding by copying...
link: Thanks James :)
I still don't understand why Erel indicated You don't need to do...
B4A Tutorial [B4X] Optional sub parameters - Erel    
Aug 26, 2026   
(26 reactions) Sub ToString (MaxNumberOfRows As Int = 5) As String
'Calling:
ToString
ToString(10)
Declaring optional sub parameters in Java library:
public static String BytesToString(byte Data...,
@DefaultValue("UTF-8") String CharSet)
'calling:
BytesToString(b)
BytesToString(b, 0, b...This is a new feature that will be added to the B4X tools.
Optional sub parameters are parameters..., the compiler inserts the default value.
This provides an opportunity to set reasonable defaults...
B4A Library [B4X] B4XEncryption - Erel    
Sep 10, 2025   
(24 reactions)   
tags: B4XEncryption, Security, encrypt, B4A it on a different platform.
Usage example:
Sub EncryptText(text As String, password As String) As Byte()
Dim c As B4XCipher
Return c.Encrypt(text.GetBytes("utf8"), password)
End Sub
Sub DecryptText(EncryptedData() As Byte, password As String) As String
Dim c As B4XCipher
Dim b() As Byte = c.Decrypt(EncryptedData, password)
Return BytesToString(b, 0, b.Length, "utf8")
End Sub
Dim encryptedData() As Byte = EncryptText("confidential", "123456")
Log...
B4A Question bc.StringToBytes irritation [solved] - Hans- Joachim Krahe (first post)    
Nov 27, 2018... really need ascii for writing midiFile bitwise. thanks for help - writing MidiFile now works :-)...
link: UTF-8 works as expected. One symbol takes up to 4 bytes (see https://en.wikipedia.org/wiki/UTF-8...
link: Why don't you just use f.e. "sometext".Getbytes... etc. If you are trying to send...
link: " make adaptiones? what is the alternative?
... ok, Dim b2() As Byte = bc.StringToBytes(text...
B4A Library [B4X] [class] MJPEG decoder - Erel    
Jul 9, 2018   
(15 reactions)   
tags: B4X CLASS MJPEG Decoder, Video, Erel and raw bytes.
It is tempting to convert the bytes to a string. However raw bytes do not represent... down the program).
Edit: For new projects it is recommended to use BytesBuilder.
The following sub is used to search for strings or bytes in the raw bytes directly:
Private Sub IndexOfString(s As String, Start As Int) As Int
Return IndexOf(s.GetBytes("ASCII"), Start)
End Sub
Private Sub IndexOf(bs() As Byte, Start As Int) As Int
For i = Start To index - 1 - bs.Length
For b...
B4A Question How can I turn string to byte and turn byte to string? - Erel (first post)    
Nov 6, 2016   
(1 reaction)) 'convert to bytes
Log(BytesToString(b, 0, b.Length, "UTF8")) 'convert to string...You should post the relevant code and error message as text instead of screenshots.
String...
link: /android/forum/threads/b4x-b4rserializator-send-and-receive-objects-instead-of-bytes.72404/#post-460481...
link: into a bytes array...
Dealing with strings in arduino is somewhat complex, so Erel created...
Page: 1  
2  
3  
4  
5  
6