Giter Club home page Giter Club logo

otp's People

Contributors

bfreis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

otp's Issues

TOTP tests fail

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.

otp/otp

Line 27 in e0d6117

dt=$(date +%s --date="@$dt_str" 2>/dev/null)

otp/otp

Line 34 in e0d6117

dt=$(date +%s --date="$dt_str" 2>/dev/null)

otp/otp

Line 199 in e0d6117

dt=$(date --date="$dt_str" +%s)

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

base32: invalid input

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.