Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1789] iPhone implementation of SHA-1 algorithm does not work correctly

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:57:10.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0 M05
ComponentsiOS
Labelsauthentication, ios, iphone, regression, sha1
ReporterJesse Domack
AssigneeReggie Seagraves
Created2011-04-15T03:02:27.000+0000
Updated2011-04-17T01:57:10.000+0000

Description

The iPhone implementation of the sha-1 algorithm does not work correctly. It only returns the first 32 characters of the hash instead of the full 40. Perusing the code, I found that the error lies in the convertToHex function in UtilsModule.m. This function is only designed to return the first 32 characters, and currently ignores anything else. As a temporary work-around, I added a convertToHex40 function which does the exact same thing, only it is configured for 40 characters. While I realize this is not an ideal fix, it solves my problem temporarily.

On a side note, the Android implementation of this function works great.

Thanks for your help in advance.

Sincerely,
Jesse Domack

Attachments

FileDateSize
utilsmodule.m2011-04-15T03:02:27.000+00003602

Comments

  1. Jeff Haynie 2011-04-15

    this is a regression that needs to be fixed before final 1.5. please look at this patch.

  2. Jeff Haynie 2011-04-15

    (from [9819ce06dba4a30bcff7331b925e0f2dd912ebab]) [#1789 state:fixed-in-qa] Hex encoding can handle variable-width strings. https://github.com/appcelerator/titanium_mobile/commit/9819ce06dba4a30bcff7331b925e0f2dd912ebab"> https://github.com/appcelerator/titanium_mobile/commit/9819ce06dba4...

  3. Ralf Pfeiffer 2011-04-15

    Thomas, please let us know when you have validated this.

  4. Jeff Haynie 2011-04-15

    (from [7ba98399b953d1e25b03ee704c5d579492af83e6]) [#1789] Placing fix for sha1 in 1.5.0 release. https://github.com/appcelerator/titanium_mobile/commit/7ba98399b953d1e25b03ee704c5d579492af83e6"> https://github.com/appcelerator/titanium_mobile/commit/7ba98399b953...

  5. Thomas Huelbert 2011-04-15

    4.2.1 ipod touch 4gt, ipad 3.2.

  6. Thomas Huelbert 2011-04-15

    confirmed in 1.5.1 and 1.5.0 9a6c6ca

JSON Source