[Plugin]CB Hash (MD5, SHA-1 and SHA-256)

Post your completed addons to share with the community

Post » Mon Jan 13, 2014 7:15 pm

@sntran: Are you sure the data "responded from server" is handled and used correctly in C2 ? (same data format (the expression expects a string/text), not trying to hash before having received the data, etc...) ?
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Tue Jan 14, 2014 1:47 am

@Kyatri: Yes, you are correct. I cleared out the hash before trying to access it. It generates correctly now.

However, there is another issue I have with base64 pad. When I set it to "=", it actually sets it to "1" instead. Likewise, 0 for "". Is it intended?

I modified your code to actually set to "=", but maybe my use case is different.
B
5
G
1
Posts: 3
Reputation: 431

Post » Tue Jan 14, 2014 3:07 am

@sntran: I'm sorry, I don't understand what you mean by "When I set it to "=", it actually sets it to "1" instead. Likewise, 0 for ""."

Keep in mind I've done the plugin and the example files more than 2 years ago.
If you have a specific issue, please post a capx stating clearly what and where the issue is so that I can have a look into it.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Fri Feb 07, 2014 4:54 pm

Thank you for this @Kyatric. It's effective and simple enough even for me to understand!
...busy learning Unity - real lights etc!
(but c2 is easily the quickest way to make 2d html5 games)!
B
60
S
15
G
50
Posts: 2,085
Reputation: 33,190

Post » Tue Feb 25, 2014 1:51 am

Hi @Kyatric, how can i md5 a ajax Request?

Example: In C2 i submit some values with Ajax Request "http://game.com/score.php?name="& var1 &"&score="& var2 &"&key="&hash

in the php file i compare the key and the md5 hash:

$output_hash = md5($var1 . $var2 . $key); if output_has == $ hash { do something };

I tried a few examples and tutorials, but i dont get it yet. I am not very savy with this algoritms to encode stuff.

"" & CBHash.MD5("url") ?

Thanks
B
29
S
5
G
1
Posts: 125
Reputation: 3,174

Post » Tue Feb 25, 2014 8:25 am

@lwgames: Your php code is requiring to md5 hash 3 concatenated elements.
(The "." is the equivalent of "&" in Construct2 as far as string manipulation goes.)

In your URL ends that would be "" & MD5(var1 & var2 & key)
Where "var1", "var2" and "key" are Construct2 variables.

If this doesn't work, try "" & MD5B(var1 & var2 & key) which is about the same but the output is BASE64 so a "secured"/encrypted URL.

Here your issue is not with the algorithm but with the PHP I'd say.
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Tue Feb 25, 2014 1:01 pm

Kyatric wrote:@lwgames: Your php code is requiring to md5 hash 3 concatenated elements.
(The "." is the equivalent of "&" in Construct2 as far as string manipulation goes.)

In your URL ends that would be "" & MD5(var1 & var2 & key)
Where "var1", "var2" and "key" are Construct2 variables.

If this doesn't work, try "" & MD5B(var1 & var2 & key) which is about the same but the output is BASE64 so a "secured"/encrypted URL.

Here your issue is not with the algorithm but with the PHP I'd say.


Thanks mate, this helps
B
29
S
5
G
1
Posts: 125
Reputation: 3,174

Post » Sun Mar 09, 2014 1:31 am

Minor request, can you update this plug-in to include the below:
http://caligatio.github.io/jsSHA/ ? SHA512 seems unlikely to ever be broken, at least compared to SHA256.

I also request some basic scrypt implementation, basically:
V(1) = hash(message)
V(2) = hash(hash(message))
...
and then the final hash is hash( V(1)+V(2)+...V(n) )

This is a good plugin.
B
9
S
3
G
1
Posts: 191
Reputation: 1,725

Post » Sat Jun 07, 2014 10:12 am

Nice work kyatric thanks
B
206
S
27
G
13
Posts: 1,840
Reputation: 35,810

Post » Thu Oct 09, 2014 11:45 pm

I just updated to the latest version of C2, and I also just downloaded the version of the MD5 Hash plugin that I found in the first post of this thread, and I'm getting no love. Is there a more recent version of the plugin I should be using?
Last edited by Sestenes on Sat Oct 11, 2014 2:47 pm, edited 1 time in total.
B
9
S
1
Posts: 33
Reputation: 612

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 0 guests