Issue 396 in google-authenticator: (Android) Codes are incorrectly generated because Math.pow() is inaccurate

75 views
Skip to first unread message

google-aut...@googlecode.com

unread,
Jun 28, 2014, 11:10:31 AM6/28/14
to google-authen...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 396 by RTitles...@gmail.com: (Android) Codes are incorrectly
generated because Math.pow() is inaccurate
http://code.google.com/p/google-authenticator/issues/detail?id=396

My Zest T1 generates codes which are incorrect because the calculation of
10^6 using (int) Math.pow() in PasscodeGenerator comes to 999 999 instead
of 1 000 000.

I've cloned the repo and committed a fix based on RFC 6238 here:
https://code.google.com/r/rtitlestad-math-pow-fix/


--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

google-aut...@googlecode.com

unread,
Jun 28, 2014, 11:12:32 AM6/28/14
to google-authen...@googlegroups.com

Comment #1 on issue 396 by RTitles...@gmail.com: (Android) Codes are
incorrectly generated because Math.pow() is inaccurate
http://code.google.com/p/google-authenticator/issues/detail?id=396

Here's the specific revision:
https://code.google.com/r/rtitlestad-math-pow-fix/source/detail?r=44d6789c0a94483d7d8a1b1021d5683ebf156772

google-aut...@googlecode.com

unread,
Sep 7, 2014, 3:28:30 PM9/7/14
to google-authen...@googlegroups.com

Comment #2 on issue 396 by ludek.ra...@r73.info: (Android) Codes are
incorrectly generated because Math.pow() is inaccurate
https://code.google.com/p/google-authenticator/issues/detail?id=396

Same issue with Doogee DG800. I tested the fix suggested by the issue
reporter.

google-aut...@googlecode.com

unread,
Sep 11, 2014, 9:47:10 PM9/11/14
to google-authen...@googlegroups.com

Comment #3 on issue 396 by qui...@gmail.com: (Android) Codes are
incorrectly generated because Math.pow() is inaccurate
https://code.google.com/p/google-authenticator/issues/detail?id=396

Thanks Rowan, I use your fix and now generate valid codes.

google-aut...@googlecode.com

unread,
Sep 13, 2014, 11:52:21 AM9/13/14
to google-authen...@googlegroups.com

Comment #4 on issue 396 by BassR...@gmail.com: (Android) Codes are
incorrectly generated because Math.pow() is inaccurate
https://code.google.com/p/google-authenticator/issues/detail?id=396

Hi guys

My Zest T1 does exactly the same thing. I checked out the fix, but i'm not
sure how it works. Can you please explain to me how to apply this fix?

Thanks

google-aut...@googlecode.com

unread,
Sep 25, 2014, 11:03:20 AM9/25/14
to google-authen...@googlegroups.com

Comment #5 on issue 396 by dick.gre...@greevenservices.com: (Android) Codes
are incorrectly generated because Math.pow() is inaccurate
https://code.google.com/p/google-authenticator/issues/detail?id=396

Same issue with Doogee DG310. Please explain how to appy the fix. TIA.

google-aut...@googlecode.com

unread,
Sep 25, 2014, 1:26:37 PM9/25/14
to google-authen...@googlegroups.com

Comment #6 on issue 396 by jeremie....@gmail.com: (Android) Codes are
incorrectly generated because Math.pow() is inaccurate
https://code.google.com/p/google-authenticator/issues/detail?id=396

Hi,

I had the same problem with my Alcatel OneTouch Pop S7. I built the app
including the fix, for KitKat devices, because my device is running Android
4.2.2 and i think sharing it can be usefull.

Attachments:
Google Authenticator.apk 693 KB

google-aut...@googlecode.com

unread,
Sep 26, 2014, 3:06:32 AM9/26/14
to google-authen...@googlegroups.com

Comment #7 on issue 396 by BassR...@gmail.com: (Android) Codes are
incorrectly generated because Math.pow() is inaccurate
https://code.google.com/p/google-authenticator/issues/detail?id=396

Hi

Thanks for sharing your .apk. This is a big help.
Tested : working.

Kind Regards

google-aut...@googlecode.com

unread,
Sep 26, 2014, 4:22:51 AM9/26/14
to google-authen...@googlegroups.com

Comment #8 on issue 396 by dick.gre...@greevenservices.com: (Android) Codes
are incorrectly generated because Math.pow() is inaccurate
https://code.google.com/p/google-authenticator/issues/detail?id=396

Hi

Thanks indeed. Works like a charm. Makes my life a little bit easier and my
accounts a little bit more safe.

Best regards

google-aut...@googlecode.com

unread,
Nov 18, 2014, 6:36:07 PM11/18/14
to google-authen...@googlegroups.com

Comment #9 on issue 396 by m...@simple.com: (Android) Codes are incorrectly
I suspect the commonality between all these phones is going to be a CPU
from Mediatek:
http://www.gizchina.com/2013/10/20/mediatek-mtk6582-resource-budget-quad-core-chinese-phones/

I have the DG580 and it has this exact problem, I see others posting with
Doogee as well.

google-aut...@googlecode.com

unread,
Jan 2, 2015, 4:48:56 PM1/2/15
to google-authen...@googlegroups.com
Updates:
Status: Fixed

Comment #10 on issue 396 by hab...@google.com: (Android) Codes are
incorrectly generated because Math.pow() is inaccurate
https://code.google.com/p/google-authenticator/issues/detail?id=396

Potential fix has been merged:
https://github.com/google/google-authenticator-android/pull/4

This project has moved to github.
If the problem remains, please re-open there.
Reply all
Reply to author
Forward
0 new messages