Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RAR password with symbols truncated #656

Closed
liushulun opened this issue Oct 26, 2020 · 16 comments
Closed

RAR password with symbols truncated #656

liushulun opened this issue Oct 26, 2020 · 16 comments
Assignees
Milestone

Comments

@liushulun
Copy link

liushulun commented Oct 26, 2020

Hi all, I'm so glad to have this utility on mac. But I'm wondering that, although compress / decompress with chinese character password is supported, I still need to copy the character from other place and paste into keka, it's somehow not convenient enough. And sometimes if I forget what I've copied, I'll have to check the content, that makes it low efficiency.

Looking forward to your reply~

@aonez
Copy link
Owner

aonez commented Oct 27, 2020

Hi @liushulun! I'm sorry I'm not familiar with the way Chinese characters are typed. What you need that Keka is lacking to write those characters? Maybe you can share a screencast showing what's needed?

@aonez aonez added this to the Look at milestone Oct 27, 2020
@Gimmy1206
Copy link

Gimmy1206 commented Oct 28, 2020

Keka always get error message when the password with Chinese character.
but use BetterZip is fine.

@aonez
Copy link
Owner

aonez commented Oct 28, 2020

Please @Gimmy1206 open a separate issue if you have trouble extracting a file.
Anyway it should work, just check those RAR a 7Z test files with password 汉字: Test.zip

@Gimmy1206
Copy link

test.rar and test.7z all work.
I don't understand what happened. maybe is the password too long?
you can test this RAR with password【x-o-x.org】【44FB985C08_by_MEGAFUNPRO.COM】【17C8472BFA_by_OKFUN.ORG】【FCBZONEBDD4F0A112_by_FCBZONE.ORG】【HG4S83816NBVD_by_peru-boundary.com】【FASTJHM63C6BFA69NPG_by_FastZone.ORG】【倉庫 @http://txbpyc.com】:
test.zip

@gingerbeardman
Copy link
Contributor

gingerbeardman commented Oct 28, 2020

the password is this whole long line:

【x-o-x.org】【44FB985C08_by_MEGAFUNPRO.COM】【17C8472BFA_by_OKFUN.ORG】【FCBZONEBDD4F0A112_by_FCBZONE.ORG】【HG4S83816NBVD_by_peru-boundary.com】【FASTJHM63C6BFA69NPG_by_FastZone.ORG】【倉庫 @http://txbpyc.com】

That's 196 characters, but 228 bytes.

Success

  • BetterZip
  • Entropy
  • MacPAR Deluxe

Fail

  • Keka (repeatedly asks for password)
  • rar 5.91, 6.00b1 command line ("The specified password is incorrect.")
  • RAR Expander ("The file 'test.rar' is not a RAR archive.")
  • RAR-Archive Utility (fails silently; no error)
  • StuffIt Expander ("The structure of the archive is damaged.")

@gingerbeardman
Copy link
Contributor

gingerbeardman commented Oct 28, 2020

Looking at rar command line closer, the problem for that tool is the space character in the last part of the password, meaning the password is not recognised as one string.

If you remove the space character, or escape it with a preceding \ character, then the password is still valid and rar will extract it.

$ rar e test.rar -p【x-o-x.org】【44FB985C08_by_MEGAFUNPRO.COM】【17C8472BFA_by_OKFUN.ORG 】【FCBZONEBDD4F0A112_by_FCBZONE.ORG】【HG4S83816NBVD_by_peru-boundary.com】【FASTJHM63C6BFA69NPG_by_FastZone.ORG】【倉庫@http://txbpyc.com】

RAR 6.00 beta 1   Copyright (c) 1993-2020 Alexander Roshal   24 Oct 2020
Trial version             Type 'rar -?' for help


Extracting from test.rar

Extracting  test.txt                                                  OK 
All OK

Success

  • rar 5.91, 6.00b1 command line

Fail

  • Keka (repeatedly asks for password)
  • RAR Expander ("The file 'test.rar' is not a RAR archive.")
  • RAR-Archive Utility (fails silently; no error)
  • StuffIt Expander ("The structure of the archive is damaged.")

@gingerbeardman
Copy link
Contributor

gingerbeardman commented Oct 28, 2020

Looking further, it seems that the whole long password may not required to decrypt the rar?

This password will extract the file using rar command line tool:

【x-o-x.org】【44FB985C08_by_MEGAFUNPRO.COM】【17C8472BFA_by_OKFUN.ORG 】【FCBZONEBDD4F0A112_by_FCBZONE.ORG】【HG4S83816NBVD_by_peru-boun

Length: 127 characters, but 146 bytes.

But this truncated password is not seen as valid for the other apps that previously extracted the file with the full password.

I read the following:

Please note that RAR maximum file encryption password length is 127 characters. Longer passwords are truncated to this length.

So there are many issues at play here.

I think support for longer password than the recommended spec varies by app.

Solution use a password of 127 characters or less.

@aonez
Copy link
Owner

aonez commented Oct 28, 2020

Thanks for all the research and testing @gingerbeardman. You're right there, 127 truncated passwords. The other issue here is the symbol

  • Passing the password parameter it works: rar e test.rar -p***
  • Using the pipe (not informing the -p argument) fails most probably breaks the coding: rar e test.rar

Keka uses the later, thus it fails. BetterZip (and probably the others) use XADMaster so no parameter involved there.

@aonez
Copy link
Owner

aonez commented Nov 2, 2020

The symbols 【】 count two characters instead of one in the code that reads it (from stdin redirection). So the password is truncated way before it should. I've fixed this one and reported it to RARLAB.

Here a build to test: Keka-v1.2.0-rc.1.r4158.7z
Here the patch I've applied to fix this issue: encoding-truncated-password.patch.zip

@Gimmy1206
Copy link

Thanks! @aonez can fix this.
I don't need another rar archive app finally.

@liushulun
Copy link
Author

liushulun commented Nov 3, 2020

Hi @liushulun! I'm sorry I'm not familiar with the way Chinese characters are typed. What you need that Keka is lacking to write those characters? Maybe you can share a screencast showing what's needed?

Hi @aonez! Sorry for waiting so long. I got this problem that, when inputing password while extracting or encrypting, keka doesn't allow me to change my input source to chinese pinyin, so that I can only type english characters, like the two screenshots below:

encrypting

extracting

I can still copy the Chinese characters and paste into the edit box, but not convenient though.

note: When typing password in Keka, [click caps-lock] would switch to uppercase, which should be switching input source as default shortcut on mac. Thus I guess Keka doesn't support typing the characters in other languages.

Hope chinese characters inputing could be supported later~

@gingerbeardman
Copy link
Contributor

@liushulun do other password fields in macOS allow switching input source?

@aonez aonez added the fixed label Nov 3, 2020
@aonez aonez modified the milestones: Look at, 1.2.0 Nov 3, 2020
@aonez aonez added rar and removed enhancement labels Nov 3, 2020
@aonez
Copy link
Owner

aonez commented Nov 3, 2020

@gingerbeardman @liushulun just checked this is not possible in a standard password field. So I've created a new ticket to include an option to show the passwords (no using a secure field with asterisks) in #659.

Since this ticked evolved in to a RAR password fix I'm closing it and the original Chinese characters question will be fixed in #659 😉

@aonez aonez closed this as completed Nov 3, 2020
@aonez aonez changed the title [REQ]Is that possible to support chinese character password input ? RAR password with symbols truncated Nov 3, 2020
@liushulun
Copy link
Author

liushulun commented Nov 4, 2020

@liushulun do other password fields in macOS allow switching input source?

That reminds me, thx @gingerbeardman !!!

@gingerbeardman @liushulun just checked this is not possible in a standard password field. So I've created a new ticket to include an option to show the passwords (no using a secure field with asterisks) in #659.

Since this ticked evolved in to a RAR password fix I'm closing it and the original Chinese characters question will be fixed in #659 😉

@aonez It will helps a lot! As far as I know, this is the common way in chinese extract/encrypt software. Thx !!!

@aonez
Copy link
Owner

aonez commented Nov 25, 2020

As a final followup, this is now also fixed in rarlab's rar and unrar binaries since version 6.00 beta 2.

Extracted from whatsnew.txt:

   Version 6.00 beta 2

   1. Bugs fixed:

      a) Unix RAR version failed to correctly process manually entered
         passwords if they did not exceed the maximum allowed 127 characters
         in UTF-32 encoding, but exceeded this threshold in UTF-8.

@aonez
Copy link
Owner

aonez commented Oct 27, 2021

Another followup, in latest rar 6.10 beta 1 the previous message was removed from the whatsnew.txt but this one is added:

   Version 6.10 beta 1

...

   8. Warning is issued if entered password exceeds the allowed limit
      of 127 characters and is truncated. Previously such passwords
      had been truncated silently.

...

So you all made this possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants