Shoutbox

[SOLVED]Md5 login system? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [SOLVED]Md5 login system? (/showthread.php?tid=61792)

[SOLVED]Md5 login system? by Lou on 06-27-2006 at 07:13 PM

For my bot utilities script, I'd like to have a multiple admin login system. What I need to know is, how would I go about calculating md5 from a recieved message.

Example: !login lou_habs | mypassword
The script would grab the user and see if it's in the login list, if it is, it grabs the password (after the |) and calculates the md5. Then it checks if the md5 matches with variable "md5".

Short: Grab username, check if it matches, if it does, grab password, calculate md5, see if it matches


RE: [HELP]Md5 login system? by Ezra on 06-27-2006 at 07:36 PM

Try this JavaScript function

http://pajhome.org.uk/crypt/md5/md5.js


RE: [HELP]Md5 login system? by Lou on 06-27-2006 at 07:43 PM

quote:
Originally posted by Ezra
Try this JavaScript function

http://pajhome.org.uk/crypt/md5/md5.js
How would I go about using that code? I think it has something to do with these functions but I'm not sure
code:
/*
* These are the functions you'll usually want to call
* They take string arguments and return either hex or base-64 encoded strings
*/function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}
function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }

edit: What I mean is, how would I tell my own code to transfer text to md5 afterwards?
RE: [HELP]Md5 login system? by L. Coyote on 06-27-2006 at 07:48 PM

Have you thought about looking at the site, Lou? => http://pajhome.org.uk/crypt/md5/

quote:
When you want to calculate a hash, use:

<script type="text/javascript" >
  hash = hex_md5("input string");
</script>

RE: [HELP]Md5 login system? by Ezra on 06-27-2006 at 07:50 PM

Just call one of those functions from your code.

For example

var hashedpassw = hex_md5("password");

EDIT: I tested it because that script is JavaScript and not JScript, but it seems to work.

I tested with this:

function OnEvent_Initialize(MessengerStart)
{
  Debug.Trace("   MD5: " + hex_md5("hello_world"));
}

and just added the md5.js file in the same folder as the test script.


RE: [HELP]Md5 login system? by Lou on 06-27-2006 at 07:52 PM

quote:
Originally posted by Leonardo
Have you thought about looking at the site, Lou?
Nope I thought it was just a download :$

So I could go "Onwhateverevent();{
  hash = hex_md5("input string")
  return hash;
}
and that would give me the md5 code I need?
RE: [HELP]Md5 login system? by absorbation on 06-27-2006 at 07:54 PM

Hang on, this checks the deatails on an external webpage? If so, md5 information on the webpage, it would be alot more sercure :P.


RE: [HELP]Md5 login system? by Lou on 06-27-2006 at 07:55 PM

quote:
Originally posted by absorbation
Hang on, this checks the deatails on an external webpage? If so, md5 information on the webpage, it would be alot more sercure :P.
External? No this would run directly in the scripts file.
I'll try that code you gave ezra and I'll post back.

edit: It works perfectly. Thank you:)
RE: [HELP]Md5 login system? by Ezra on 06-27-2006 at 07:59 PM

quote:
Originally posted by .Lou
quote:
Originally posted by Leonardo
Have you thought about looking at the site, Lou?
Nope I thought it was just a download :$

So I could go "Onwhateverevent();{
  hash = hex_md5("input string")
  return hash;
}
and that would give me the md5 code I need?

well... why would you return the has on an event?

and you don't need to make another function. If you add that script file in the folder it's like it's one big file, so you can just call the function like it's in your script.

var hash = hex_md5("password");
RE: [HELP]Md5 login system? by Lou on 06-27-2006 at 08:05 PM

quote:
Originally posted by Ezra
and you don't need to make another function. If you add that script file in the folder it's like it's one big file, so you can just call the function like it's in your script.
No its because I want to check the recieved message, if it's !login <username> | <password> then itll take <password> and see if it matches:P