Xojo.Core.MemoryBlock into sqlite

The old framework crypto and the encodeHex functions allowed me to submit the results into a SQLite DB.

The new framework crypto returns a Xojo.Core.Memory block and the encodeHex still returns a string.

What is the best way to take the Xojo.core.MemoryBlock contents (crypto hash) and submit it to a db?

Thanks!

Maybe Xojo.IO.BinaryStream?

Eli thanks but I can’t make this work… Any other thoughts?

You can write your own hex encoder easily enough, or you can convert from the new MemoryBlock to an old one, then use EncodeHex.

Thanks Kem. I have been placing with different scenarios and I feel like I have been playing with a puzzle. I am going to use your recommendation for either encodeHex or EncodeBase64.

I do wish these functions accepted the Xojo.Core.MemoryBlock type vs. String. That is a miss right now.

Kem,

Outside of basic reading on google apparently the Windows1242 encoding handles my hash properly thus far where UTF8 can’t. Do you see this working for me long term?

    Dim testSaltMB as MemoryBlock = createSalt(32)
    Dim thisTest as Text = Xojo.Core.TextEncoding.Windows1252.ConvertDataToText(testSaltMB)
    Dim thisStr as String = thisTest.ToCString( Xojo.Core.TextEncoding.Windows1252)
    Dim encTestSalt as String = EncodeBase64(thisStr,0)

any single byte encoding except ascii should be able to since they define all 256 code points
there are some sequences in utf8 that are illegal

Or you could use the code we posted when you last asked this :stuck_out_tongue:

https://forum.xojo.com/27506-new-framework-for-encodehex

[quote=232618:@Norman Palardy]Or you could use the code we posted when you last asked this :stuck_out_tongue:

https://forum.xojo.com/27506-new-framework-for-encodehex[/quote]
I did… I spent over 4 hours on it all together. It works fine for small sections, but when I am trying to build and end to end hashing system the new framework seems to kill me. Maybe I’ll need more experience with it or something, but until them Ill just use the old frame work for it all. I figure I’d ask again differently since I am sure I am not the only one attempting a login / hashing using a sqlite db using only the new framework. :slight_smile:

Thanks for all of the help!

Rewrote it using the old framework in about 15 minutes…
Luckily this is a WE app. Moving on :slight_smile:

[quote=232615:@Norman Palardy]any single byte encoding except ascii should be able to since they define all 256 code points
there are some sequences in utf8 that are illegal[/quote]
Yes I ran into them just about everytime :wink: