Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using a program because of a rar password that i've forgot and it's keeping passwords tries because of length.

Is that a limitation because it's shareware or is there really a limit in the max size of a rar password?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

Here is the proof of nixda's answer:

I use rar v4 and unrar v4.10 on Linux.

I wrote a C code to test the length of the password:

int main(void){

    char password[150];
    int i=0, j =0;
    int r;
    for (i=0; i<150 ; i++){
        r = rand()%10;
        password[i]= (char)(((int)'0')+r);
    }

    char command[300] = {'\0'};
    sprintf(command, " rar a -p[%s] hi.rar hi.txt",password);
    printf("password: %s\n", command);
    system(command);

    usleep(50000);
    char newcommand[300] = {'\0'};
    char newpassword[150] = {'\0'};
    for (i= 0 ; i < 301; i++){
        for(j=0; j<i; j++){
            newpassword[j] = password[j];
        }
        sprintf(newcommand, " unrar e -p[%s] -o+ hi.rar",newpassword);
        if (system(newcommand) >= 0 ){
            printf("i: %d\n",i);
            printf("password length: %d\n", strlen(newpassword));
           // break;
        }
    strcpy(newpassword, "0");
    usleep(500000);
    }
    return 0;
}

It creates a 150 character long randomly generated numeric (0 to 9) password then compress an example file (hi.txt in this case). On the second part of the code, it tries to decompress with the previously generated password from 1th character to the 150 character. I added usleep to be able to monitor the outputs (or you can just use script on linux to save the outputs then read them).

What I got is that it was able to decompress the encrypted file on the 126th index and after all which means that it truncates the password after the 127th character (note that the index started from 0).

Extracting from hi.rar

Extracting  hi.txt                                                    40%
CRC failed in the encrypted file hi.txt. Corrupt file or wrong password.
Total errors: 1
i: 124
password length: 124

UNRAR 4.10 freeware      Copyright (c) 1993-2012 Alexander Roshal


Extracting from hi.rar

Extracting  hi.txt                                                    40%
CRC failed in the encrypted file hi.txt. Corrupt file or wrong password.
Total errors: 1
i: 125
password length: 125

UNRAR 4.10 freeware      Copyright (c) 1993-2012 Alexander Roshal


Extracting from hi.rar

Extracting  hi.txt                                                    OK 
All OK
i: 126
password length: 126

UNRAR 4.10 freeware      Copyright (c) 1993-2012 Alexander Roshal


Extracting from hi.rar

Extracting  hi.txt                                                    OK 
All OK
i: 127
password length: 127

Extracting from hi.rar

Extracting  hi.txt                                                    OK 
All OK
i: 128
password length: 128

UNRAR 4.10 freeware      Copyright (c) 1993-2012 Alexander Roshal


Extracting from hi.rar

Extracting  hi.txt                                                    OK 
All OK
i: 129
password length: 129
share|improve this answer
4  
+1 for science. –  Alvin Wong Jul 12 '13 at 3:07
    
great job. +1 certainly –  FernandoSBS Jul 29 '13 at 11:59

Maximum password length for RAR archives is 127 characters. Longer passwords are truncated to this length

Source

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.