bfreis / otp Goto Github PK
View Code? Open in Web Editor NEWOne Time Password generation with Bash
License: MIT License
One Time Password generation with Bash
License: MIT License
When I run the bash otp --run-tests
the totp tests are failing.
I'm running the command on a Mac Pro macOS Big Sur 11.1 (20C69) on Intel Chip.
I have the recommended software installed (brew install coreutils openssl bash).
See the output of the run-tests below:
bash otp --run-tests
[PASS] hotp(3132333435363738393031323334353637383930, 0) = 755224 == 755224
[PASS] hotp(3132333435363738393031323334353637383930, 1) = 287082 == 287082
[PASS] hotp(3132333435363738393031323334353637383930, 2) = 359152 == 359152
[PASS] hotp(3132333435363738393031323334353637383930, 3) = 969429 == 969429
[PASS] hotp(3132333435363738393031323334353637383930, 4) = 338314 == 338314
[PASS] hotp(3132333435363738393031323334353637383930, 5) = 254676 == 254676
[PASS] hotp(3132333435363738393031323334353637383930, 6) = 287922 == 287922
[PASS] hotp(3132333435363738393031323334353637383930, 7) = 162583 == 162583
[PASS] hotp(3132333435363738393031323334353637383930, 8) = 399871 == 399871
[PASS] hotp(3132333435363738393031323334353637383930, 9) = 520489 == 520489
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[FAIL] totp(3132333435363738393031323334353637383930, ) = 86283265 == 94287082
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[FAIL] totp(3132333435363738393031323334353637383930313233343536373839303132, ) = 38732398 == 46119246
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[FAIL] totp(31323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334, ) = 31695031 == 90693936
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[FAIL] totp(3132333435363738393031323334353637383930, ) = 86283265 == 07081804
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[FAIL] totp(3132333435363738393031323334353637383930313233343536373839303132, ) = 38732398 == 68084774
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[FAIL] totp(31323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334, ) = 31695031 == 25091201
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[FAIL] totp(3132333435363738393031323334353637383930, ) = 86283265 == 14050471
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[FAIL] totp(3132333435363738393031323334353637383930313233343536373839303132, ) = 38732398 == 67062674
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[FAIL] totp(31323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334, ) = 31695031 == 99943326
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[FAIL] totp(3132333435363738393031323334353637383930, ) = 86283265 == 89005924
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[FAIL] totp(3132333435363738393031323334353637383930313233343536373839303132, ) = 38732398 == 91819424
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[FAIL] totp(31323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334, ) = 31695031 == 93441116
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[FAIL] totp(3132333435363738393031323334353637383930, ) = 86283265 == 69279037
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[FAIL] totp(3132333435363738393031323334353637383930313233343536373839303132, ) = 38732398 == 90698825
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[FAIL] totp(31323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334, ) = 31695031 == 38618901
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[FAIL] totp(3132333435363738393031323334353637383930, ) = 86283265 == 65353130
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[FAIL] totp(3132333435363738393031323334353637383930313233343536373839303132, ) = 38732398 == 77737706
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[FAIL] totp(31323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334, ) = 31695031 == 47863826
Failed tests: 18.
Please open an issue at: https://github.com/bfreis/otp
I changed the date command from date +%s --date="@$dt_str"
to date -j -f "%Y-%M-%dT%TZ" "@$dt_str" "+%s"
, but this only resolved the date illegal option error.
The changes lead to the following output:
bash /Users/mw/Seafile/Secrets/cmp-pannet/vpn/otp --run-tests
[PASS] hotp(3132333435363738393031323334353637383930, 0) = 755224 == 755224
[PASS] hotp(3132333435363738393031323334353637383930, 1) = 287082 == 287082
[PASS] hotp(3132333435363738393031323334353637383930, 2) = 359152 == 359152
[PASS] hotp(3132333435363738393031323334353637383930, 3) = 969429 == 969429
[PASS] hotp(3132333435363738393031323334353637383930, 4) = 338314 == 338314
[PASS] hotp(3132333435363738393031323334353637383930, 5) = 254676 == 254676
[PASS] hotp(3132333435363738393031323334353637383930, 6) = 287922 == 287922
[PASS] hotp(3132333435363738393031323334353637383930, 7) = 162583 == 162583
[PASS] hotp(3132333435363738393031323334353637383930, 8) = 399871 == 399871
[PASS] hotp(3132333435363738393031323334353637383930, 9) = 520489 == 520489
[FAIL] totp(3132333435363738393031323334353637383930, 2674859) = 69110493 == 94287082
[FAIL] totp(3132333435363738393031323334353637383930313233343536373839303132, 2674859) = 99434264 == 46119246
[FAIL] totp(31323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334, 2674859) = 06782705 == 90693936
[FAIL] totp(3132333435363738393031323334353637383930, 1108688309) = 80887688 == 07081804
[FAIL] totp(3132333435363738393031323334353637383930313233343536373839303132, 1108688309) = 57807705 == 68084774
[FAIL] totp(31323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334, 1108688309) = 91582096 == 25091201
[FAIL] totp(3132333435363738393031323334353637383930, 1108688311) = 97973896 == 14050471
[FAIL] totp(3132333435363738393031323334353637383930313233343536373839303132, 1108688311) = 92084829 == 67062674
[FAIL] totp(31323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334, 1108688311) = 71192049 == 99943326
[FAIL] totp(3132333435363738393031323334353637383930, 1234564290) = 82576249 == 89005924
[FAIL] totp(3132333435363738393031323334353637383930313233343536373839303132, 1234564290) = 42738668 == 91819424
[FAIL] totp(31323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334, 1234564290) = 50630307 == 93441116
[FAIL] totp(3132333435363738393031323334353637383930, 1992306800) = 40637266 == 69279037
[FAIL] totp(3132333435363738393031323334353637383930313233343536373839303132, 1992306800) = 86877580 == 90698825
[FAIL] totp(31323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334, 1992306800) = 39821240 == 38618901
[FAIL] totp(3132333435363738393031323334353637383930, 19979087600) = 44470725 == 65353130
[FAIL] totp(3132333435363738393031323334353637383930313233343536373839303132, 19979087600) = 75274354 == 77737706
[FAIL] totp(31323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334, 19979087600) = 04958886 == 47863826
Failed tests: 18.
Please open an issue at: https://github.com/bfreis/otp
When i run "sh opt.sh --run-tests"
base32: invalid input
[FAIL] hotp(, 0) = 328482 == 755224
[FAIL] hotp(, 1) = 812658 == 287082
[FAIL] hotp(, 2) = 073348 == 359152
[FAIL] hotp(, 3) = 887919 == 969429
[FAIL] hotp(, 4) = 320986 == 338314
[FAIL] hotp(, 5) = 435986 == 254676
[FAIL] hotp(, 6) = 964213 == 287922
[FAIL] hotp(, 7) = 267638 == 162583
[FAIL] hotp(, 8) = 985814 == 399871
[FAIL] hotp(, 9) = 003773 == 520489
base32: invalid input
base32: invalid input
base32: invalid input
os: Mac OS 10.15.7
base32 --version
base32 (GNU coreutils) 8.31
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.