SHA-2 Support

Something you want to see in a LiveCode product? Want a new forum set up for a specific topic? Talk about it here.

Moderator: Klaus

Post Reply
EddieColumbus
Posts: 5
Joined: Mon Dec 08, 2008 1:00 am

SHA-2 Support

Post by EddieColumbus »

I have a project that I would like to use LiveCode, but need SHA-256 in order to interact with a REST API on a server. According to WikiPedia this algorithm is part of SHA-2 and I believe we only have SHA-1 with the current LiveCode release. I do not see where it would be feasible to try to depend on third-party software which would add unnecessary complexity/overhead or trying to cobble together something SDKs that are platform specific along with LiveCode.
Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: SHA-2 Support

Post by Mark »

Hi,

Look here http://qery.us/3ae and follow the link in that forum thread.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
johnleee
Posts: 1
Joined: Thu Dec 06, 2012 1:06 pm

Re: SHA-2 Support

Post by johnleee »

There are a few options. You can do what you want with PHP and you can call a PHP script with a URL in LiveCode. Another possibility is using views and triggers in the database. You could do a query on a view without affecting the database. The query would run a trigger, which could be a lengthy SQL script.
nice
gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: SHA-2 Support

Post by gpb01 »

Mark wrote: Look here http://qery.us/3ae and follow the link in that forum thread.
... or go directly here and download the library : http://marksmith.on-rev.com/revstuff/ :D

Guglielmo
Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: SHA-2 Support

Post by Mark »

Guglielmo, I wanted to make clear the OP could have searched the forum and would easily have found the link by himself.

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: SHA-2 Support

Post by FourthWorld »

Mark wrote:Guglielmo, I wanted to make clear the OP could have searched the forum and would easily have found the link by himself.
Searching here for both "sha2" and "sha-2" yields zero results for each.

I think there's something off about the search feature's indexing.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: SHA-2 Support

Post by Mark »

Hi,

"sha" returns some results. Don't give up too quickly.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: SHA-2 Support

Post by FourthWorld »

Mark wrote:"sha" returns some results. Don't give up too quickly.
True, it's possible to try various permutations until you find the right one, but since sha-1 is supported in the LiveCode language it seems reasonable that someone looking for something else would try a more specific search.

Indeed, of the 24 posts a search for "sha" yields, only one contains the link to Mark's stuff, and you'd almost have to know that's what you're looking for since the text surrounding it in the search results provides no clarity. Many of the rest only make reference to the existing sha-1 support.

While I'm glad to see the indexer here isn't as broken as others have described it, I also appreciate community members like Guglielmo willing to take a moment out to provide quick specific answers.

Thanks for that post, Guglielmo. Mark's repository is quite a valuable legacy.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: SHA-2 Support

Post by gpb01 »

FourthWorld wrote:...
Thanks for that post, Guglielmo. Mark's repository is quite a valuable legacy.
You're welcome Richard :)

Guglielmo
Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: SHA-2 Support

Post by Mark »

Sure. I already know you like repetition. I did take the effort of finding that one post and linking to it and I think you could thank me instead of nagging me for it.

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
terjud
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2
Joined: Tue Mar 01, 2011 10:05 pm

Re: SHA-2 Support

Post by terjud »

OK - looks like I need to do this REST stuff as well - hope I'm not too late to the party. I downloaded Mark Smith's library and tried out the hmacsha256.hex function but it gives me different results to those provided by our web developer when I use the uri and private key he provided me with. Is there anything I need to do to the uri or the key before I pass it to the function?

Terry...
Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: SHA-2 Support

Post by Mark »

Terry,

Can you show your script (without keys) and the output?

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
terjud
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2
Joined: Tue Mar 01, 2011 10:05 pm

Re: SHA-2 Support

Post by terjud »

Thanks for replying Mark but I had another crack at it this afternoon and it looks like we're all good now. It turns out there were some unexpected characters in the key string that was supplied to me. Once I identified those and stripped them out the two hashes matched. So I can REST easy now - ouch!

Regards,

Terry...
Post Reply