diff options
author | Your Name <you@example.com> | 2019-07-18 12:13:17 +0100 |
---|---|---|
committer | Your Name <you@example.com> | 2019-07-18 12:13:17 +0100 |
commit | 9b5367618ae9d3fbae4b00264ab24dbaa03613b1 (patch) | |
tree | 84ae61afcc5008d6df964921aabf8c55ca1800cd /sha1/test | |
parent | bb787b60b3e7aacb90cf43ba70102e0460f90b67 (diff) | |
download | wristapps-9b5367618ae9d3fbae4b00264ab24dbaa03613b1.tar.gz wristapps-9b5367618ae9d3fbae4b00264ab24dbaa03613b1.tar.bz2 wristapps-9b5367618ae9d3fbae4b00264ab24dbaa03613b1.zip |
debug improvements
Diffstat (limited to 'sha1/test')
-rwxr-xr-x | sha1/test/totp.pl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sha1/test/totp.pl b/sha1/test/totp.pl index 5903133..cd40aa0 100755 --- a/sha1/test/totp.pl +++ b/sha1/test/totp.pl @@ -171,7 +171,11 @@ sub generateCurrentNumber { my $offset = hex(substr($hmac, -1)); print "offset=",$offset,"\n"; # take the 4 bytes (8 hex chars) at the offset (* 2 for hex), and drop the high bit - my $encrypted = hex(substr($hmac, $offset * 2, 8)) & 0x7fffffff; + my $hex = substr($hmac, $offset * 2, 8); + my $encrypted = hex($hex) & 0x7fffffff; + + print "hex=",sprintf("%08x", $encrypted),"\n"; + # the token is then the last 6 digits in the number my $token = $encrypted % 1000000; |