Giter Club home page Giter Club logo

otp's Introduction

Build Status

libotp implements RFC4226 and RFC6238. These RFCs are implemented by Google's Google Authenticator.

OTP can increases the security for various things, such as web services, servers and even private computers.

How OTP works

A secret is shared between the client and a device. Passwords are generated based on the shared secret.

It is possible to work in two modes:

  1. Counter based - The OTP is generated with a counter that is increased on each successful attempt.
  2. Time based - The OTP is generated based on time. Codes are valid for a pre-configured amount of time.

Features

  • HTOP - HMAC One-Time-Password generation (RFC4226).
    • Configurable HMAC - SHA1, SHA256 or SHA512.
  • TOTP - Time based One-Time-Password generation (RFC6238).
    • Configurable time step, RFC recommended is 30 seconds.
    • Configurable T0 (start time).

otp's People

Contributors

gallegogt avatar naim94a 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  avatar

otp's Issues

libotp is broken now, unable to compile.

[mattricks@lauer api]$ cargo run
    Blocking waiting for file lock on build directory
   Compiling ring v0.14.6
error[E0283]: type annotations needed
   --> /home/mattricks/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.14.6/build.rs:475:52
    |
475 |                 let _ = c.flag("-Wl,--gc-sections".into());
    |                           ----                     ^^^^
    |                           |
    |                           required by a bound introduced by this call
    |
    = note: multiple `impl`s satisfying `_: AsRef<OsStr>` found in the following crates: `cc`, `std`:
            - impl AsRef<OsStr> for OsStr;
            - impl AsRef<OsStr> for OsString;
            - impl AsRef<OsStr> for Path;
            - impl AsRef<OsStr> for PathBuf;
            - impl AsRef<OsStr> for String;
            - impl AsRef<OsStr> for str;
            - impl AsRef<OsStr> for windows_registry::Env;
note: required by a bound in `Build::flag`
   --> /home/mattricks/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.101/src/lib.rs:513:39
    |
513 |     pub fn flag(&mut self, flag: impl AsRef<OsStr>) -> &mut Build {
    |                                       ^^^^^^^^^^^^ required by this bound in `Build::flag`
help: try using a fully qualified path to specify the expected types
    |
475 |                 let _ = c.flag(<&str as Into<T>>::into("-Wl,--gc-sections"));
    |                                ++++++++++++++++++++++++                   ~
help: consider removing this method call, as the receiver has type `&'static str` and `&'static str: AsRef<OsStr>` trivially holds
    |
475 -                 let _ = c.flag("-Wl,--gc-sections".into());
475 +                 let _ = c.flag("-Wl,--gc-sections");
    |

For more information about this error, try `rustc --explain E0283`.
error: could not compile `ring` (build script) due to 1 previous error

Looks like a problem with a dependency called ring.

Is it normal that totp can valiate multiple times in the time frame?

the test code:

        let time_step = 3;
        let otp = match totp(MY_SECRET, 6, time_step, 0) {
            Some(otp) => {
                println!("Your current OTP is: {:06}", otp);
                otp
            }
            None => {
                bail!("Failed to calculate OTP.");
            }
        };
        std::thread::sleep(std::time::Duration::from_secs(time_step - 2));
        assert!(validate_totp(otp, 0, MY_SECRET, 6, time_step, 0).unwrap(), "first validation should secceed.");
        assert!(validate_totp(otp, 0, MY_SECRET, 6, time_step, 0).unwrap(), "second validation should still secceed.");

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.