From 2aa85f379bd8e18112bc27587022a0a2b79cbafb Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Tue, 16 Oct 2018 09:58:33 -0400 Subject: clarify comments --- totp.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/totp.pl b/totp.pl index 21a0c00..bfbda7d 100644 --- a/totp.pl +++ b/totp.pl @@ -9,8 +9,7 @@ sub hmac_sha1_hex_string { return Digest::SHA::hmac_sha1_hex($data, $key); } -# everything is 2 here because we are looking at the byte level.. probably -# should just convert this into a byte array but I'm a noob +# make a usable number out of that HMAC result sub hotp_truncate { my ($hex) = @_; my $lastbyte= substr $hex, -2; @@ -30,8 +29,7 @@ sub hotp_truncate { return $truncate; } -# TOTP is HOTP(K,c) where counter c is time based and changed every 30 seconds (here) -# HOTP +# TOTP is HOTP(K,c) where counter c is time based and changed every x seconds (30 here) sub totp { my ($time, $secret) = @_; @@ -43,6 +41,8 @@ sub totp { return $otp; } + +# basically HMAC(key, counter) sub hotp { my ($time, $secret) = @_; -- cgit v1.2.3