sha1 algorithm not working, missing last 8 characters

You must Login before you can answer or comment on any questions.

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.

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 3 years ago by Jesse Domack
answer 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 3 years ago 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 3 years ago by Ryan Gartin
answer 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 3 years ago 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

Your Answer

Think you can help? Login to answer this question!