Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

sha1 algorithm not working, missing last 8 characters

I'm trying to create an SHA-1 hash, and the built-in function is only returning 32 characters instead of the required 40. The first 32 characters are correct, but I need to have the last 8 as well. Any help on this would be greatly appreciated.

NOTE: this bug only exists in the iPhone implementation of Ti.Utils.sha1(). The Android implementation works correctly.

— asked August 25th 2010 by Jesse Domack
  • authorization
  • sha1
0 Comments

4 Answers

  • I found the bug in the utilsmodule.m file, and implemented a "quick fix" so my project would work correctly. I created a ticket on lighthouse to address this issue. Note that the solution I implemented is intended as a workaround only and a "proper" fix should be implemented that does not involve adding a separate function just for SHA-1.

    — answered September 20th 2010 by Jesse Domack
    permalink
    1 Comment
    • Thanks for the quick fix. I thought this was fixed in 1.4.1.1 but looks like your ticket got missed.

      — commented October 6th 2010 by Swaroop Hegde
  • http://developer.appcelerator.com/question/16951/is-it-safe-to-store-cryptographic-passwords-in-my-app

    If you need the script, my email is on that page.

    — answered August 25th 2010 by Ryan Gartin
    permalink
    1 Comment
    • Actually, I just need sha-1 for what we are doing. Ti has support for it in the current release, but it is bugged. Namely the algorithm they use to convert the hash array to a string only allows for 32 characters (I took a brief look at the source code). I would like to tell them directly where the bug is, but I don't know who to contact.

      — commented August 27th 2010 by Jesse Domack
  • track in lighthouse as https://appcelerator.lighthouseapp.com/projects/32238-titanium-mobile/tickets/2562-ios-shah1-algorithm-only-returning-32-of-40-chars

    — answered December 13th 2010 by Thomas Huelbert
    permalink
    0 Comments
  • this is now fixed in head

    — answered December 13th 2010 by Thomas Huelbert
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.