base64encode/DB replacing all "+" symbols with "space" ?

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: base64encode/DB replacing all "+" symbols with "space" ?

Post by mwieder » Wed Feb 07, 2018 2:31 am

"full code" but with a fake server.
Nontheless, what you really want in the code of button "Step 1 : Create Hash 512 and send to DB" (really not a good name for a button, btw) instead of

Code: Select all

put it into tResu
is

Code: Select all

put the result into tResu
and, of course, I get "invalid host address"

likewise, in the step 2 button you have

Code: Select all

   put it into toParse
instead of

Code: Select all

   put the result into toParse
I don't understand why you are doing

Code: Select all

   put empty into fld "FinputBb"
   put empty into fld "FinputBc"
and then expecting to work with the contents of those fields.

In short, I don't believe this is the actual code you are attempting to use.

teriibi
Posts: 254
Joined: Mon Nov 13, 2017 3:49 pm
Location: Bolivia

Re: base64encode/DB replacing all "+" symbols with "space" ?

Post by teriibi » Wed Feb 07, 2018 3:39 am

As I mentioned - to who ever really reads my posts :

" You will need your own Https server, build you own db, write your own php ..to test the stack.
Usually that is not a problem for Pros.


funny that you are requesting so much information and insignificant details !
I m not a Pro and only using LC for the past 6 month, and I have all that set up ready... how come you don t ?
What sort of App are you building in you dont have that at hand already ?

..if what you want is to test it on a "real name server", no problem,
PM me your own info about your C.Panel Log/PW
There I can build the DB, tables and upload PHP files :mrgreen: :mrgreen:
You´re really a funny Guy ! :lol: :lol:

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: base64encode/DB replacing all "+" symbols with "space" ?

Post by mwieder » Wed Feb 07, 2018 3:43 am

Well, personally I wouldn't let php onto any of my systems, so that's a no.
But since you don't mention what type of db you're using and what the php code looks like, there's not much to go on.

I don't think we're going to get much farther on this, so I'm done here.

teriibi
Posts: 254
Joined: Mon Nov 13, 2017 3:49 pm
Location: Bolivia

Re: base64encode/DB replacing all "+" symbols with "space" ?

Post by teriibi » Wed Feb 07, 2018 3:57 am

No biggie, I only need someone with the proper knowledge of the "Checking size difference" Script portion, thats the only reason why I share the Stack.

...someone with a strong coding knowledge wont even need to run it, just by reading the script he/she will understand whats going on. :idea: I have Java coder´s friend and that is how they can work.
I m a bit surprise that you´d actualy want to run the stack to actually understanf how it is working :lol: :lol: , sorry.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: base64encode/DB replacing all "+" symbols with "space" ?

Post by FourthWorld » Wed Feb 07, 2018 5:51 am

mwieder wrote:
Wed Feb 07, 2018 3:43 am
Well, personally I wouldn't let php onto any of my systems
Why?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: base64encode/DB replacing all "+" symbols with "space" ?

Post by bogs » Wed Feb 07, 2018 6:03 am

Well, I don't know why he wouldn't run php, but, I suspect that calling his coding skill level into question isn't helpful...
teriibi wrote:
Wed Feb 07, 2018 3:57 am
...someone with a strong coding knowledge wont even need to run it, just by reading the script he/she will understand whats going on.
I mean he has only been doing this what, since about the dawn of time? I'm pretty sure he knows more than most might about every aspect of the language.

While I don't usually chime in with no helpful output attempted, I somehow couldn't help myself with this faux pas.
Image

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: base64encode/DB replacing all "+" symbols with "space" ?

Post by sphere » Wed Feb 07, 2018 10:34 am

Teribii,

i use encoded values too and send and retrieve them from DB.
I use MariaDB which is 100% compatible with MySQL. (it's the same inventor)
Column in DB as VarChar
Using PHP/PDO as middleware.

What i did is this:
Encrypt --> Base64Encode-->URLencode-->send to DB
Retreive from DB-->Base64Decode-->Decrypt i did not use URLDecode before Base64Decode

Although if you read the description at URLEncode in the dictionary it seems for URL only.
So i misunderstood it probably and used it for this sending the string over the internet and probably should have not.

But this is just working OK. Using URLDecode also did not work and caused strange things.

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: base64encode/DB replacing all "+" symbols with "space" ?

Post by MaxV » Wed Feb 07, 2018 11:32 am

teriibi wrote:
Tue Feb 06, 2018 8:53 pm
That would be the URLencoded string of the Hash sent.
Its the Equivalent value of the input Value before Hash inside the Zipped Stack
M%82%06%EF%15%218%BFk%DA%7DP%1Fo%5Ek%1FM%10a%D3%8Ch%3D%9BC%7F%A6%CE%83%E7%141%94M%CCp%87%11%B0%B3j%FD%5D%3C%F0%EB%E5%B3%7E%1D%E8i%94Qx%FC%B6%A7%A1%5B%AE%931
Where is the URLENCODE of the other string?

Only this way we can check where is the real difference.

However this string is equivalent to : M‚ï!8¿kÚ}Po^kMaӌh=›C¦Îƒç1”MÌp‡°³jý]<ðëå³~èi”Qxü¶§¡[®“1

It doesn't seem to me the string in the image.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

teriibi
Posts: 254
Joined: Mon Nov 13, 2017 3:49 pm
Location: Bolivia

Re: base64encode/DB replacing all "+" symbols with "space" ?

Post by teriibi » Wed Feb 07, 2018 11:57 am

You ve got the stack at hand, you can open its "Create button" script, add a line with the URLEncode and produce your string...do you really need me for adding this single line ? :shock:

http://livecode.wikia.com/wiki/URLEncode

put urlencode(textEncode("Димитрий","UTF8"))

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: base64encode/DB replacing all "+" symbols with "space" ?

Post by MaxV » Wed Feb 07, 2018 2:21 pm

Sphere is right, look better the sequence:
sphere wrote:
Wed Feb 07, 2018 10:34 am
From Client To the DB
Encrypt --> Base64Encode-->URLencode-->send to DB
The DB has the value urldecoded because it's the URL language and the apache (or other) server know that +=space and so on...

From DB TO the Client
Retreive from DB-->Base64Decode-->Decrypt.
Here I did not use URLDecode before Base64Decode
Data are stored correctly, you don't need urldecode
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: base64encode/DB replacing all "+" symbols with "space" ?

Post by FourthWorld » Wed Feb 07, 2018 2:50 pm

Use hex rather than base64 and all this goes away.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: base64encode/DB replacing all "+" symbols with "space" ?

Post by MaxV » Wed Feb 07, 2018 6:09 pm

FourthWorld wrote:
Wed Feb 07, 2018 2:50 pm
Use hex rather than base64 and all this goes away.
However base64encode produce shorter strings, so in case of bigger data, it saves much more space/bandwidth/time.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7228
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: base64encode/DB replacing all "+" symbols with "space" ?

Post by jacque » Wed Feb 07, 2018 6:34 pm

teriibi wrote:
Wed Feb 07, 2018 3:57 am
...someone with a strong coding knowledge wont even need to run it, just by reading the script he/she will understand whats going on. :idea: I have Java coder´s friend and that is how they can work.
I m a bit surprise that you´d actualy want to run the stack to actually understanf how it is working :lol: :lol: , sorry.
Mark is a paid professional, has been working with LC as long as I have, codes in several different languages, and has written a custom LC debugger. He probably can read your scripts. Testing, however, does require stepping through the code to view the variables and I imagine that's what he was doing.

Most of the pros here don't have time to set up a system to do volunteer work. I myself only answer questions that I already know, I almost never download stacks to explore them.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: base64encode/DB replacing all "+" symbols with "space" ?

Post by sphere » Wed Feb 07, 2018 6:54 pm

at ease Teriibi, people are trying to help so you can learn, as i still do and make many dumb mistakes, read to fast etcetera.
We all learn(ed) by trial and error.
Providing a stack makes it easy for a helper to look into and more easily too see where a bottleneck might be.
There could be something else in the stack next to your piece of code what stops it from functioning the way you want. It's no ones obligation to help, they do it for fun and they like Livecode.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: base64encode/DB replacing all "+" symbols with "space" ?

Post by FourthWorld » Wed Feb 07, 2018 10:20 pm

MaxV wrote:
Wed Feb 07, 2018 6:09 pm
FourthWorld wrote:
Wed Feb 07, 2018 2:50 pm
Use hex rather than base64 and all this goes away.
However base64encode produce shorter strings, so in case of bigger data, it saves much more space/bandwidth/time.
The difference in length between a hex representation of a SHA3 hash and a base64 representation is ~40 bytes. The average Internet speed is ~25 Mbps.

This makes the additional transfer time incurred by using hex roughly 0.0119019 milliseconds per transmission.

If we conservatively assume that all of us have collectively spent ~10 hours trying to find workarounds for the formatting issues inherent in using base64 for hashes, the system would need to transmit hashes 3,025,210,084 times before the 40-bytes savings hits break-even.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Internet”