Page 3 of 4

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

Posted: Wed Feb 07, 2018 2:31 am
by mwieder
"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.

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

Posted: Wed Feb 07, 2018 3:39 am
by teriibi
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:

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

Posted: Wed Feb 07, 2018 3:43 am
by mwieder
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.

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

Posted: Wed Feb 07, 2018 3:57 am
by teriibi
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.

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

Posted: Wed Feb 07, 2018 5:51 am
by FourthWorld
mwieder wrote: Wed Feb 07, 2018 3:43 am Well, personally I wouldn't let php onto any of my systems
Why?

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

Posted: Wed Feb 07, 2018 6:03 am
by bogs
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.

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

Posted: Wed Feb 07, 2018 10:34 am
by sphere
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.

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

Posted: Wed Feb 07, 2018 11:32 am
by MaxV
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.

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

Posted: Wed Feb 07, 2018 11:57 am
by teriibi
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"))

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

Posted: Wed Feb 07, 2018 2:21 pm
by MaxV
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

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

Posted: Wed Feb 07, 2018 2:50 pm
by FourthWorld
Use hex rather than base64 and all this goes away.

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

Posted: Wed Feb 07, 2018 6:09 pm
by MaxV
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.

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

Posted: Wed Feb 07, 2018 6:34 pm
by jacque
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.

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

Posted: Wed Feb 07, 2018 6:54 pm
by sphere
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.

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

Posted: Wed Feb 07, 2018 10:20 pm
by FourthWorld
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.