MD5 hash -- need help

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
shadowslash
Posts: 344
Joined: Tue Feb 24, 2009 6:14 pm
Contact:

MD5 hash -- need help

Post by shadowslash » Sat Aug 08, 2009 6:24 am

How do I get the MD5 Hash of a file? Are there any PlugIns or externals to do just that? If I'm going to do it manually through mind breaking calculations, how do I do it?

NOTE:
I know that most of you will answer "Why not use the md5Digest function instead?" so here's my answer. I need to get the MD5 Hash, not the digest so that it returns a series of numbers and letters (e.g. 5d3325fe7c6b04981a6abfa9bfa94c58) and not a lot of mumbo jumbo characters. I need it to be this way so that the file structure of a program I'm making wouldn't be too complicated.
Parañaque, Philippines
Image
Image

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

Post by Mark » Sat Aug 08, 2009 9:16 am

Dear shadowslash,

Digest and hash are the same. Usually they are presented in hex form, rather than mumbojumbo form. You can achieve that by means of the binaryDecodefunction.

Code: Select all

put url "file:<path to file>" into myData
put md5Digest(myData) into myMumboJumbo
get binarydecode("H*",myMumboJumbo,myHash)
put myHash --> 6d756d626f6a756d626f (sample)
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

shadowslash
Posts: 344
Joined: Tue Feb 24, 2009 6:14 pm
Contact:

Post by shadowslash » Sun Aug 09, 2009 6:04 am

That bit of code worked! Thanks.... Image
Parañaque, Philippines
Image
Image

alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Re: MD5 hash -- need help

Post by alemrantareq » Sat Dec 06, 2014 9:37 pm

thanks Mark for the script; now I can encrypt a word with md5 hash. but how to decrypt the same thing? I tried to use binaryencode but it gives wrong report :(

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

Re: MD5 hash -- need help

Post by Mark » Sat Dec 06, 2014 9:41 pm

Hi,

Hashes work one way. You can't decode them. (But there are now lists for the md5 hash, which sometimes allow you to look up the original string of a hash).

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

alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Re: MD5 hash -- need help

Post by alemrantareq » Sun Dec 07, 2014 1:31 pm

I see there are some online decoders available which can decode md5 hash...is it possible to bring it into rev script?

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

Re: MD5 hash -- need help

Post by Mark » Sun Dec 07, 2014 2:24 pm

Hi,

Since you cant decode md5, those decoders don't seem to do what you think they do, but if you give an example of what you want to do exactly, perhaps we can use them. Do you have a link to those decoders?

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

alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Re: MD5 hash -- need help

Post by alemrantareq » Sun Dec 07, 2014 2:36 pm

http://www.hashkiller.co.uk/md5-decrypter.aspx

this is the decoder which can decode almost every md5 hashes perfectly. I tried to find the source. but seems it works with some external javscripts. here're some md5 hashes I've tried to decode:

Code: Select all

d99fe76e1e3b1cbfb029869b40f19887
f5a574a0fca7376241d045b16f677ae9
3c4dce9aea556c3f27b8b1dd2e8987ae
982966947a612364d45e1989d7940a4f
88c98f2e37be980d92f8aa1bd6d929e1
f5f50eed1a617882b2ddf6c48d514feb
5dc71b9d48aa35c03a9098bc7537fbb3

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

Re: MD5 hash -- need help

Post by Mark » Sun Dec 07, 2014 2:43 pm

That page doesn't decrypt anything. It has a database with hashes and source strings. When you enter a base64 encoded string, the website looks up the hash and returns the original string. Although there are billions of hashes in their databases, there are many more hashes that aren't.

The website has a forum, where you can ask if there is a command line tool or an API for e.g. PHP. If such a tool or API is available, then you can probably connect to it from within LiveCode.

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

alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Re: MD5 hash -- need help

Post by alemrantareq » Sun Dec 07, 2014 2:48 pm

I better ask them for the API which gives me comfort in making such tool :)

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: MD5 hash -- need help

Post by FourthWorld » Sun Dec 07, 2014 4:06 pm

May i ask your intended use for this?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: MD5 hash -- need help

Post by jacque » Sun Dec 07, 2014 5:12 pm

Richard's question is mine too. If you are looking for encryption there are other ways to do that which work both directions. md5 is usually just used to verify that a copy of a file or a string matches the original.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply