Time-based one-time password algorithm: Difference between revisions

added Perl programming solution
m (→‎{{header|Raku}}: Fix code: Perl 6 --> Raku)
(added Perl programming solution)
Line 354:
514592
514592
</pre>
 
=={{header|Perl}}==
{{trans|Raku}}
<lang Perl># 20200704 added Perl programming solution
 
use strict;
use warnings;
 
use Authen::OATH;
 
my $message = "show me the monKey"; # convert to base32 is optional
 
my $oath = Authen::OATH->new(); # default SHA1 and TI=30
 
for ( my $t = 2177452800 ; $t < 2177452919 ; $t += 13 ) {
print "At ", scalar gmtime $t, " : ", $oath->totp( $message, $t ), "\n" ;
}</lang>
{{out}}
<pre>
At Sat Jan 1 00:00:00 2039 : 950428
At Sat Jan 1 00:00:13 2039 : 950428
At Sat Jan 1 00:00:26 2039 : 950428
At Sat Jan 1 00:00:39 2039 : 361382
At Sat Jan 1 00:00:52 2039 : 361382
At Sat Jan 1 00:01:05 2039 : 022576
At Sat Jan 1 00:01:18 2039 : 022576
At Sat Jan 1 00:01:31 2039 : 341623
At Sat Jan 1 00:01:44 2039 : 341623
At Sat Jan 1 00:01:57 2039 : 341623
</pre>
 
350

edits