Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Encrypt password ---- Fixed Problem

  1. #1
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Encrypt password ---- Fixed Problem

    hello guys i have fixed some problems in Encrypt password script

    here is the corrected script

    First of all u need to make ur own password
    click in this link and make ur own password
    http://www.dynamicdrive.com/dynamicindex9/password.htm

    And now use this code instead of that
    Code:
    <script>
    //Encrypted Password script- By Rob Heslop
    //Script featured on Dynamic Drive 
    //Visit http://www.dynamicdrive.com 
    
    function submitentry(){
    password = document.password1.password2.value.toLowerCase()
    username = document.password1.username2.value.toLowerCase()
    passcode = 1
    usercode = 1
    for(i = 0; i < password.length; i++) {
    passcode *= password.charCodeAt(i);
    }
    for(x = 0; x < username.length; x++) {
    usercode *= username.charCodeAt(x);
    }
    if(usercode==<script>
    //Encrypted Password script- By Rob Heslop
    //Script featured on Dynamic Drive 
    //Visit http://www.dynamicdrive.com 
    
    function submitentry(){
    password = document.password1.password2.value.toLowerCase()
    username = document.password1.username2.value.toLowerCase()
    passcode = 1
    usercode = 1
    for(i = 0; i < password.length; i++) {
    passcode *= password.charCodeAt(i);
    }
    for(x = 0; x < username.length; x++) {
    usercode *= username.charCodeAt(x);
    }
    //CHANGE THE NUMBERS BELOW TO REFLECT YOUR USERNAME/PASSWORD
    if(usercode==1552379774400&&passcode==15415039530)
    //CHANGE THE NUMBERS ABOVE TO REFLECT YOUR USERNAME/PASSWORD
    {
    window.location="http://change.hiya-host.com/vishal/flash clock.html"}
    else{
    alert("Username/password combination wrong")}
    }
    </script>
    
    <form name="password1">
    <strong>Enter username: </strong>
    <input type="text" name="username2" size="15">
    <br>
    <strong>Enter password: </strong>
    <input type="password" name="password2" size="15">
    
    <input type="button" value="Submit" onClick="submitentry()">
    </form><script>
    //Encrypted Password script- By Rob Heslop
    //Script featured on Dynamic Drive 
    //Visit http://www.dynamicdrive.com 
    
    function submitentry(){
    password = document.password1.password2.value.toLowerCase()
    username = document.password1.username2.value.toLowerCase()
    passcode = 1
    usercode = 1
    for(i = 0; i < password.length; i++) {
    passcode *= password.charCodeAt(i);
    }
    for(x = 0; x < username.length; x++) {
    usercode *= username.charCodeAt(x);
    }
    //CHANGE THE NUMBERS BELOW TO REFLECT YOUR USERNAME/PASSWORD
    if(usercode==1552379774400&&passcode==15415039530)
    //CHANGE THE NUMBERS ABOVE TO REFLECT YOUR USERNAME/PASSWORD
    {
    window.location="http://change.hiya-host.com/vishal/flash clock.html"}
    else{
    alert("Username/password combination wrong")}
    }
    </script>
    and change the password and username numbes accordingly and enjoy
    Last edited by vishal; 08-31-2005 at 01:32 PM.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    That is some seriously messed up code.
    It defines submitentry() thrice.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    which one this code or the previous one

    actually i got the same prob with the code in present in the home page

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Look at it. You've just pasted
    <script>
    //Encrypted Password script- By Rob Heslop
    //Script featured on Dynamic Drive
    //Visit http://www.dynamicdrive.com

    function submitentry(){
    password = document.password1.password2.value.toLowerCase()
    username = document.password1.username2.value.toLowerCase()
    passcode = 1
    usercode = 1
    for(i = 0; i < password.length; i++) {
    passcode *= password.charCodeAt(i);
    }
    for(x = 0; x < username.length; x++) {
    usercode *= username.charCodeAt(x);
    }
    if(usercode==<script>
    three times. That won't even run.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Oct 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Please note that this script is not secure.

    It is cracked in 3-10 seconds using the following C program:

    #include <stdio.h>

    Code:
    static unsigned char alphabet[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    static asize = sizeof(alphabet) - 1;
    
    static int
    crack_code_of_length(int code, unsigned char *buf, int cno, int pwlen) {
    	int pcode;
    	int i;
    
    	for(buf[cno] = 0, pcode = 1, i = 0; i < cno; i++)
    		pcode *= buf[i];
    	if(pcode > code)
    		return -1;
    	if(pcode == code)
    		printf("%s\n", buf);
    
    	if(cno < pwlen) {
    		int sym;
    		for(sym = 0; sym < asize; sym++) {
    			buf[cno] = alphabet[sym];
    			if(crack_code_of_length(code, buf, cno + 1, pwlen))
    				return 0;
    		}
    	}
    
    	return 0;
    }
    
    #define	MAXPASSWORDLENGTH	7
    int
    main(int ac, char **av) {
    	unsigned char buf[MAXPASSWORDLENGTH + 1];
    	int code;
    
    	int pwlen;
    	if(ac != 2) {
    		fprintf(stderr, "Usage: %s <code>\n", av[0]);
    		return 1;
    	}
    
    	code = atoi(av[1]);
    	for(pwlen = 1; pwlen <= MAXPASSWORDLENGTH; pwlen++)
    		crack_code_of_length(code, buf, 0, pwlen);
    	return 0;
    }

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Yes, the algorithm is rather insecure. I've noted this and modified the script to allow other algorithms (Paj's MD5 implementation by default) in my rewrite of the script.

    Congratulations on cracking it, though Do you do a lot of crypto?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Those JavaScript passwords all have a mathematical formula though. It's not impossible (almost though... ) I've tried it before and have come pretty close.

    941094 would be the hash for abc.

    To decrypt it, you would first devide it by 99, then 98 then 97 and if the result is "1" you know you've solved it. The three numbers you devided it by are the letters.
    97 = a
    98 = b
    99 = c
    etc
    which is the breakdown of charCodeAt
    - Mike

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Of course they can be cracked. It should, however, be very difficult, and take a theoretically large amount of years -- thus the point in irreversible hashing algorithms such as MD5. Nothing can secure the webmaster against a bad password, though.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Yes MD5 is irreversible. I love math though, these things just thrill me
    - Mike

  10. #10
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    In the hash code though there is 26 to the power of the number of characters possibilities. So if the password was "hello" there would be 11881376 possiblities. So yes. It would take a while lol
    - Mike

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •