[TIMOB-1789] iPhone implementation of SHA-1 algorithm does not work correctly
| GitHub Issue | n/a | 
|---|---|
| Type | Bug | 
| Priority | Medium | 
| Status | Closed | 
| Resolution | Fixed | 
| Resolution Date | 2011-04-17T01:57:10.000+0000 | 
| Affected Version/s | n/a | 
| Fix Version/s | Release 1.5.0 M05 | 
| Components | iOS | 
| Labels | authentication, ios, iphone, regression, sha1 | 
| Reporter | Jesse Domack | 
| Assignee | Reggie Seagraves | 
| Created | 2011-04-15T03:02:27.000+0000 | 
| Updated | 2011-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
| File | Date | Size | 
|---|---|---|
| utilsmodule.m | 2011-04-15T03:02:27.000+0000 | 3602 | 
this is a regression that needs to be fixed before final 1.5. please look at this patch.
(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...
Thomas, please let us know when you have validated this.
(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...
4.2.1 ipod touch 4gt, ipad 3.2.
confirmed in 1.5.1 and 1.5.0 9a6c6ca