Giter Club home page Giter Club logo

partial-pass's People

Contributors

benhyland avatar

Watchers

 avatar  avatar

partial-pass's Issues

Successful authentication with transposed characters

@benhyland First of all, thanks for putting your work onto Github, as I have found it enormously useful in improving my understanding of this algorithm.

Not sure whether you are still interested in this repo, but I thought you might like to know;

The method used here of signing shares with |+| can allow successful authentication with transposed characters.

It seems like it's possible to avoid this by signing shares with |*| when sharing and reversing with |/| when authenticating instead.

case class Password(pw: String, indices: List[Int], from: Int, to: Int)

 val passwordGen = for {
    // Generate a length between 4 and 8
    l <- Gen.choose(4, 8)
    // Generate a list of characters of the chosen length in the ASCII printable range
    p <- Gen.listOfN(l, Gen.choose[Char]('\u0020', '\u007e'))
    // Choose distinct random indices between 0 and the max index
    a <- Gen.choose(0, l - 1)
    b <- Gen.choose(0, l - 1).suchThat(b => b != a)
    c <- Gen.choose(0, l - 1).suchThat(c => c != a && c != b)
    d <- Gen.choose(0, l - 1).suchThat(d => d != a && d != b && d != c)
    // Choose two indices to transpose
    from <- Gen.oneOf(a, b, c, d)
    to <- Gen.oneOf(a, b, c, d).suchThat(to => to != from)
  } yield Password(p.mkString, List(a, b, c, d), from, to)

  test("transposed password characters") {
    forAll(passwordGen) { pw: Password =>
      whenever(pw.pw(pw.from) != pw.pw(pw.to)) {
        val pp = new PartialPass(Sharing.random, 128, 4, pw.pw.length)
        val shares = pp.share(pw.pw)

        val candidate = CandidateShares(
          shares.secret,
          pw.indices.map(i => shares.shares(i)),
          pw.indices.map { i =>
            if (i == pw.from)
              pw.pw(pw.to)
            else if (i == pw.to)
              pw.pw(pw.from)
            else pw.pw(i)
          }.mkString
        )

        val ok = pp.authenticate(candidate)

        ok should be (false)
      }
    }
  }

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.